[R-sig-Geo] points to lines and/or polygons
Roger Bivand
Roger.Bivand at nhh.no
Tue Jan 26 13:54:27 CET 2010
On Tue, 26 Jan 2010, Agustin Lobo wrote:
> Hi!
> Package StatDA
> provides background geoinformation as a set of coordinates:
>> str(kola.background)
> List of 4
> $ boundary:'data.frame': 50 obs. of 2 variables:
> ..$ V1: num [1:50] 388650 388160 386587 384035 383029 ...
> ..$ V2: num [1:50] 7892400 7881248 7847303 7790797 7769214 ...
> $ coast :'data.frame': 6259 obs. of 2 variables:
> ..$ V1: num [1:6259] 438431 439102 439102 439643 439643 ...
> ..$ V2: num [1:6259] 7895619 7896495 7896495 7895800 7895542 ...
> $ borders :'data.frame': 504 obs. of 2 variables:
> ..$ V1: num [1:504] 417575 417704 418890 420308 422731 ...
> ..$ V2: num [1:504] 7612984 7612984 7613293 7614530 7615972 ...
> $ lakes :'data.frame': 6003 obs. of 2 variables:
> ..$ V1: num [1:6003] 547972 546915 NA 547972 547172 ...
> ..$ V2: num [1:6003] 7815109 7815599 NA 7815109 7813873 ...
>
> is there any spatial function aready availale to convert these coordinates
> into Spatial Lines and Spatial Polygons?
This seems to work at least for SpatialLines - for polygons, the rings may
need to be closed:
library(StatDA)
data(kola.background)
xy <- kola.background$boundary
names(xy) <- c("x", "y")
library(maptools)
bdy <- map2SpatialLines(xy)
plot(bdy)
The data are in the legacy S format (like the maps package).
Roger
>
> Thanks
>
> Agus
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list