[R-sig-Geo] converting latitude and longitude to UTM
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Fri Feb 1 17:38:04 CET 2013
Note to Abby:
>>NYC2<-readShapePoly("nybb.shp") # this is a map of the NYC boroughs
if your shapefile has a nybb.prj file that will contain the
information about the coordinate system. However, readShapePoly DOES
NOT read it (unless there's been some updates...)
You should use readOGR from rgdal to read shapefiles:
> uk=readShapePoly("ukos.shp")
> ukOGR=readOGR(".","ukos")
OGR data source with driver: ESRI Shapefile
Source: ".", layer: "ukos"
with 1 features and 14 fields
Feature type: wkbMultiPolygon with 2 dimensions
Warning message:
In readOGR(".", "ukos") : Deleted feature IDs: 1, 2, 3
> proj4string(uk)
[1] NA
- the object created with readShapePoly has no projection info, but:
> proj4string(ukOGR)
[1] "+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000
+y_0=-100000 +ellps=airy +units=m +no_defs"
- the one read via readOGR has a full projection string.
This makes it easier to transform to another system.
Barry
More information about the R-sig-Geo
mailing list