I am importing a polygon shapefile from Arcmap that has already a projection set and comes with all its files (sbn,sbx,prj,etc).
However after I use the readShapePoly
function, when I do a summary it looks like the projection information is blank. Is the projection included already or not recognized?
Object of class SpatialPolygonsDataFrame
Coordinates:
min max
x 35551.4 1585917
y 6318047.3 9408727
Is projected: NA
proj4string : [NA]
Data attributes:
I know there is a proj4string
attribute but it's not clear how to use it and the prj file it's already attached to the .shp file. I can consider another function that does a better job if there is one. Not sure if rgdal
with readOGR
does what I want.
edit follow up: I tried with readOGR
thanks for the reply. I am using this code test<-readOGR(dsn=getwd(), layer="grid") and the shapefile is here speedy.sh/Ry8rU/grid.zip and it still doesn't read the projection.
readOGR()
, as it'll preserve/capture the projection info. – Josh O'Brienmap <- readOGR(dsn = system.file("vectors", package="rgdal"), layer="scot_BNG"); proj4string(map)
orOGRSpatialRef(dsn = system.file("vectors", package="rgdal"), layer="scot_BNG")
to see the expected behavior of those functions. The fact that it retains projection info is one big reason to prefer rgdal over maptools for data import. – Josh O'Brien