Hi,

Trying to extract a map (package maps) to a shapefile, IIUC the procedure
is to get it into a SpatialPolygonsDataFrame and then use
writePolyShape().  This seems to require an intermediate step through
SpatialPolygons.  However, I'm running into some problems:


R> canada <- map("world2Hires", "Canada", plot=FALSE)
R> canada_sp <- map2SpatialPolygons(canada, IDs=canada$names,
+                                  proj4string=CRS("+proj=longlat 
+ellps=wgs84"))
Error in map2SpatialPolygons(canada, IDs = canada$names, proj4string = 
CRS("+proj=longlat +ellps=wgs84")) : 
        map and IDs differ in length


How can these two components be lined up?

I would also appreciate some suggestions on how to write a projection file
for the shapefile.  I can see this has been discussed in the past, but at
that time there was no solution.


Cheers,

-- 
Seb

_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to