[R-sig-Geo] readOGR not reading in prj file?
Denis mutiibwa
mutiibwa2000 at yahoo.com
Wed Apr 6 17:24:33 CEST 2016
Hi Vinh,proj4string function is giving you NA because "shapebase" shapefile doesn't have an auxiliary file "shapebase.prj" Denis Mutiibwa,
On Wednesday, April 6, 2016 10:46 AM, Vinh Nguyen <vinhdizzo at gmail.com> wrote:
>Hi,
>I'm currently using rgdal v 1.1-1 on R 3.2.2. It appears my
>projection file is not being read in by readOGR:
>
>> dFloodRisk <- readOGR(floodshapedir, shapebase)
>OGR data source with driver: ESRI Shapefile
>Source: "FloodShapes", layer: "2013Spring_Flood_Drawn"
>with 8 features
>It has 2 fields
> proj4string(dFloodRisk)
>[1] NA
>
>I have to manually pass in the CRS:
>> dFloodRisk <- readOGR(floodshapedir, paste0(curYear, 'Spring_Flood_Drawn'), p4s='+init=EPSG:3857')
>OGR data source with driver: ESRI Shapefile
>Source: "FloodShapes", layer: "2013Spring_Flood_Drawn"
>with 8 features
>It has 2 fields
>> proj4string(dFloodRisk)
>[1] "+init=EPSG:3857 +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0
>+lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"
>
>Any thoughts on why readOGR doesn't automatically read in the prj
>file? Here's the content of the prj file:
>PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Gree>nwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER[">>Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]
>
>Thanks so much for your help.
>
>-- Vinh
_______________________________________________
R-sig-Geo mailing list
R-sig-Geo at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list