[R-sig-Geo] readOGR and proj4 string

Agustin Lobo Agustin.Lobo at ija.csic.es
Thu Apr 10 08:42:30 CEST 2008


The manual page of readOGR states:

p4s 	PROJ4 string defining CRS, if default NULL, the value is read from 
the OGR data set

then, if a  *.prj file is present for a *.shp,
why is the proj4string of the resulting SpatialPolygonsDataframe
set to NA? is this a general behaviour or am I doing someting
wrong?

 > absUTMpolysHABS2 <- readOGR("C:/ALOBO/Lidia",layer="test_TNT")

where I have:

test_TNT.avl
test_TNT.dbf
test_TNT.prj
test_TNT.shp
test_TNT.shx

with test_TNT.prj:

PROJCS["ED50_/_UTM_zone_31N_(CM_3E)",GEOGCS["ED50_/_Geographic",DATUM["D_European_1950",SPHEROID["International_1924",6378388.0,297.0]TOWGS84[,-87.0,-98.0,-121.0,0.0,0.0,0.0,0.0]],PRIMEM["Greenwich",0.0],UNIT["Decimal_Degree",0.01745329251994330]],PROJECTION["Transverse_Mercator"],PARAMETER["Latitude_Of_Center",0.0],PARAMETER["Longitude_Of_Origin",3.0],PARAMETER["Scale_Factor",0.9996000000],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],UNIT["Meter",1.0]]

I get:
 > class(delme)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"
 > str(delme,max.level=2)
Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots
   ..@ data       :'data.frame': 1555 obs. of  16 variables:
   ..@ polygons   :List of 1555
   ..@ plotOrder  : int [1:1555] 148 143 792 740 209 335 895 619 1127 
1160 ...
   ..@ bbox       : num [1:2, 1:2]  412000 4584000  466000 4624000
   .. ..- attr(*, "dimnames")=List of 2
   ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
 > delme at proj4string
CRS arguments: NA

Agus
-- 
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster




More information about the R-sig-Geo mailing list