I have a shapefile with shapelength and shapearea, and would like to convert to WGS84 to use with ggmap.

enter image description here

Eventually, I would like to get plot google map of individual regions of the shapefile, and overlay it with other date

What can I use in R program to do this, i.e. convert to WGS84?

  • 1
    Note: The WKID is EPSG:2263, NAD83 / New York Long Island (ftUS).
    – mkennedy
    Commented Jun 30, 2015 at 16:54

1 Answer 1


Use functions from the sp and rgdal packages. Assuming your shape file is named myshp

proj4string(myshp) # Gives the CRS of the data 
myshp=spTransform(myshp,CRS("+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")) # To convert it to WGS84

ggplot2 input has to be a DataFrame, to convert a SpatialDataFrame to a DataFrame named mydf, run

mydf=fortify(myshp,byid="your id variable") # Converting the SpatialDataFrame to a DataFrame
myshp$id=row.names(myshp) # Adding your SpatialDataFrame data to the DataFrame
  • Will try this very soon
    – Rhonda
    Commented Jul 1, 2015 at 12:13
  • When I execute proj4string(nysd) I get Error: object 'nysd' not found
    – Rhonda
    Commented Jul 1, 2015 at 12:45
  • I downloaded shapefile from nyc.gov/html/dcp/download/bytes/nysd_15b.zip
    – Rhonda
    Commented Jul 1, 2015 at 12:47
  • proj4string() uses a SpatialObject as input. To load the spatial object use setwd("your working directory");myshp=readOGR(dsn=getwd(),layer="nysd"). Then run proj4string(nysd), your CRS is NAD83.
    – goclem
    Commented Jul 1, 2015 at 12:50
  • This certainly helps
    – Rhonda
    Commented Jul 1, 2015 at 12:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.