1

I have created a polygon shapefile in ArcMap using 7 points(lat,lon) then read this shapefile into R to obtain the CRS. I then created a shape file in R using the sf package (and the 7 points) and used the CRS obtained from the ArcMap shapefile. When I bring the shapefile created in R into ArcMap I get a warning regarding different coordinate systems. Why would this happen?

My steps:

7 points (lon and lat) where point 1 = point 7 (closed loop). Create a polygon shapefile in ArcMap and display. Properties in ArcMap show : Geographic Coordinate System: GCS_North_American_1983 Datum: D_North_American_1983

In R I use rgdal to read in shapefile and obtain CRS

cashes <- rgdal::readOGR(dsn="path",layer="shapefile") 
cashes@proj4string 
This results in : "+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0 "

Now I create the shapefile in R using the sf package (I could use %>%)

Rshapefile <- readxl::read_xlsx(path,sheet="cashes")
Rshapefile <- sf::st_as_sf(Rshapefile,coords=c("lon","lat"),crs="+proj=longlat +datum=NAD83 +no_defs +ellps=GRS80 +towgs84=0,0,0 ")

Edit: At this point if i inspect Rshapefile i get this proj4string: +proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs Note: +datum=NAD83 is dropped.

Rshapefile <- dplyr::summarize(Rshapefile,geometry = sf::st_combine(geometry))
Rshapefile <- sf::st_cast(Rshapefile,"POLYGON")

sf::st_write(Rshapefile,dsn=path,layer="Rshapefile",driver="ESRI Shapefile")

I then bring this Rshapefile into ArcMap and the coordinate systems are different. When I view the properties in ArcMap they show: Geographic Coordinate System: GRS 1980(IUGG, 1980) Datum: D_unknown

Why is this? I must be doing something wrong but I can't figure out what!

  • I can't help you with this question, but thank you for including the references to the packages for each function. – Paul H Apr 8 at 14:16
  • Have you checked the CRS at each stage of manipulating Rshapefile after first assigning the CRS? – Simbamangu Apr 8 at 16:07
  • dns=path should be dsn=path. Not sure that fixes it but at least it makes your code run properly. – Spacedman Apr 8 at 18:09
  • @Spacedman. Just a typo. Code reads dsn.@Simbamangu I have editied the post to show this. The +datum = NAD83 is dropped. Not sure why or it it matters. – andy Apr 16 at 14:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.