-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
33d21b6
commit aef3806
Showing
16 changed files
with
284 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
RArcInfo RArcInfo | ||
avctoe00 Converts a ARC/INFO binary coverage into an | ||
ESRI E00 file | ||
e00toavc Converts an ESRI E00 file into an Arc/Info V | ||
7.x binary coverage | ||
get.arcdata Function for importing the contents of an ARC | ||
file into R | ||
get.bnddata Function for importing the contents of a BND | ||
file into R | ||
get.cntdata Function for importing the contents of a CNT | ||
file into R | ||
get.labdata Funtion for importing the contents of a LAB | ||
file into R | ||
get.namesofcoverages Function for getting the names of the coverages | ||
get.paldata Function for importing the contents of a PAL | ||
file into R | ||
get.tabledata Function for importing the contents of a table | ||
file into R | ||
get.tablefields Function for reading names of the table fields | ||
in the coverages | ||
get.tablenames Function for reading the names of the tables in | ||
the coverages | ||
get.toldata Function for importing the contents of a TOL | ||
file into R | ||
get.txtdata Function for importing the contents of an TXT | ||
file into R | ||
plotarc Plots the data imported from an ARC file | ||
plotpal Plots the data imported from an ARC file | ||
according to the contents of a PAL file | ||
plotpoly Plots polygons defined by the coverages. | ||
read.coverage Function for retrieving basic data from a given | ||
coverage | ||
thinlines Function for deleting points in an arc | ||
definition object | ||
RArcInfo RArcInfo | ||
avctoe00 Converts a ARC/INFO binary coverage into an | ||
ESRI E00 file | ||
e00toavc Converts an ESRI E00 file into an Arc/Info V | ||
7.x binary coverage | ||
get.arcdata Function for importing the contents of an ARC | ||
file into R | ||
get.bnddata Function for importing the contents of a BND | ||
file into R | ||
get.cntdata Function for importing the contents of a CNT | ||
file into R | ||
get.labdata Funtion for importing the contents of a LAB | ||
file into R | ||
get.namesofcoverages Function for getting the names of the coverages | ||
get.nb Function for calculating neighbouting polygons. | ||
get.paldata Function for importing the contents of a PAL | ||
file into R | ||
get.tabledata Function for importing the contents of a table | ||
file into R | ||
get.tablefields Function for reading names of the table fields | ||
in the coverages | ||
get.tablenames Function for reading the names of the tables in | ||
the coverages | ||
get.toldata Function for importing the contents of a TOL | ||
file into R | ||
get.txtdata Function for importing the contents of an TXT | ||
file into R | ||
plotarc Plots the data imported from an ARC file | ||
plotpal Plots the data imported from an ARC file | ||
according to the contents of a PAL file | ||
plotpoly Plots polygons defined by the coverages. | ||
read.coverage Function for retrieving basic data from a given | ||
coverage | ||
thinlines Function for deleting points in an arc | ||
definition object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
get.nb<-function(arc,pal,index=NULL) | ||
{ | ||
if(is.null(index)) | ||
index<-1:length(pal[[1]][[1]]) | ||
|
||
lindex<-length(index) | ||
|
||
nb<-vector(mode="list", length=lindex) | ||
|
||
arcid<-arc[[1]]$ArcId | ||
lpoly<-arc[[1]]$LeftPoly | ||
rpoly<-arc[[1]]$RightPoly | ||
|
||
for(p in 1:lindex) | ||
{ | ||
arcs<-sort(unique(abs(pal[[2]][[ index[p] ]][[1]]))) | ||
|
||
if(arcs[1]==0) | ||
arcs<-arcs[-1] | ||
|
||
arcindex<-as.vector(tapply( arcs , 1:length(arcs), | ||
function(X,arcid){which(arcid==X)} | ||
,arcid) ) | ||
|
||
thisnb<-c(lpoly[arcindex], rpoly[arcindex]) | ||
nb[[p]]<-sort(unique(thisnb)) | ||
} | ||
|
||
nb | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,88 @@ | ||
#Plots all the arcs imported from an ARC file by get.arcdata | ||
|
||
#New: T for new plots | ||
plotarc<-function(arc, new=TRUE, ...) | ||
plotarc<-function(arc, new=TRUE, index=NULL, ...) | ||
{ | ||
if(is.null(index)) | ||
index<-1:length(arc[[2]]) | ||
|
||
#We only need the list of arcs, not the dataframe with the other data | ||
arc<-arc[[2]] | ||
ll<-length(index) | ||
|
||
ll<-length(arc) | ||
#We only need the list of arcs, not the dataframe with the other data | ||
arc<-arc[[2]][index] | ||
|
||
if(new==TRUE) | ||
{ | ||
#Calculate the boundary | ||
|
||
bnd<-c(0,0,0,0) | ||
nbnd<-c(0,0,0,0) | ||
|
||
x<-arc[[1]][[1]] | ||
y<-arc[[1]][[2]] | ||
l<-as.integer(length(x)) | ||
|
||
bnd[1]<-min(x) | ||
bnd[2]<-max(x) | ||
bnd[3]<-min(y) | ||
bnd[4]<-max(y) | ||
|
||
#Set aspect ratio and display plotting window | ||
|
||
par.in <- par(no.readonly = TRUE) | ||
on.exit(par(par.in)) | ||
|
||
plot.dim<-c(bnd[3]-bnd[1], bnd[4]-bnd[2]) | ||
|
||
par(pin = min(par.in$pin) | ||
* par.in$fin / max(par.in$fin) | ||
* (plot.dim) / max(plot.dim)) | ||
|
||
|
||
|
||
for(i in 2:ll) | ||
{ | ||
|
||
x<-arc[[i]][[1]] | ||
y<-arc[[i]][[2]] | ||
l<-as.integer(length(x)) | ||
|
||
nbnd[1]<-min(x) | ||
nbnd[2]<-max(x) | ||
nbnd[3]<-min(y) | ||
nbnd[4]<-max(y) | ||
|
||
for(j in 1:2) | ||
if(new==TRUE) | ||
{ | ||
if( nbnd[2*j-1] < bnd[2*j-1] ) bnd[2*j-1]<-nbnd[2*j-1] | ||
if(nbnd[2*j]>bnd[2*j]) bnd[2*j]<-nbnd[2*j] | ||
if(!exists("xlim") || !exists("ylim") ) | ||
{ | ||
#Calculate the boundary | ||
|
||
x<-arc[[1]][[1]] | ||
y<-arc[[1]][[2]] | ||
l<-as.integer(length(x)) | ||
|
||
xmin<-min(x) | ||
xmax<-max(x) | ||
ymin<-min(y) | ||
ymax<-max(y) | ||
|
||
nxmin<-min(x) | ||
nxmax<-max(x) | ||
nymin<-min(y) | ||
nymax<-max(y) | ||
|
||
|
||
for(i in 2:ll) | ||
{ | ||
x<-arc[[i]][[1]] | ||
y<-arc[[i]][[2]] | ||
l<-as.integer(length(x)) | ||
|
||
nxmin<-min(x) | ||
nxmax<-max(x) | ||
nymin<-min(y) | ||
nymax<-max(y) | ||
|
||
if(nxmin<xmin) xmin<-nxmin | ||
if(nymin<ymin) ymin<-nymin | ||
if(nxmax>xmax) xmax<-nxmax | ||
if(nymax>ymax) ymax<-nymax | ||
} | ||
} | ||
else #if(!exists("xlim") || !exists("ylim") ) | ||
{ | ||
xmin<-xlim[1] | ||
xmax<-xlim[2] | ||
ymin<-ylim[1] | ||
ymax<-ylim[2] | ||
} | ||
|
||
range<-max( c(xmax-xmin, ymax-ymin) )/2 | ||
|
||
xmean<-(xmin+xmax)/2 | ||
ymean<-(ymin+ymax)/2 | ||
|
||
|
||
#Set aspect ratio and display plotting window | ||
|
||
par.in <- par(no.readonly = TRUE) | ||
# on.exit(par(par.in)) | ||
|
||
plot.dim<-c(ymax-ymin, xmax-xmin) | ||
print(min(par.in$pin) | ||
* par.in$fin / max(par.in$fin) | ||
* (plot.dim) / max(plot.dim)) | ||
par(pin = min(par.in$pin) | ||
* par.in$fin / max(par.in$fin) | ||
* (plot.dim) / max(plot.dim)) | ||
|
||
plot(arc[[1]][[1]], arc[[1]][[2]], xlim=c(xmean-range,xmean+range), ylim=c(ymean-range, ymean+range), type="n", ...) | ||
|
||
}##if(new) | ||
|
||
for (i in 1:ll) | ||
{ | ||
lines(arc[[i]][[1]], arc[[i]][[2]], ...) | ||
} | ||
} | ||
|
||
|
||
range<-max( c(bnd[2]-bnd[1], bnd[4]-bnd[3]) )/2 | ||
|
||
xmedian<-(bnd[1]+bnd[2])/2 | ||
ymedian<-(bnd[3]+bnd[4])/2 | ||
|
||
plot(arc[[1]][[1]], arc[[1]][[2]], xlim=c(xmedian-range,xmedian+range), ylim=c(ymedian-range, ymedian+range), type="n", ...) | ||
|
||
}##if(new) | ||
|
||
for (i in 1:ll) | ||
{ | ||
lines(arc[[i]][[1]], arc[[i]][[2]]) | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.