Reputation: 30
My data and shapefile (both for the same city) both have geospatial coordinates, but in different coordinate reference systems.
The coordinates in the data are as follows:
The coordinates of the shapefile are as follows:
I would like to convert the coordinate system in the data to match the coordinate system used in the shapefile. Thank you!
################## update:
pts <- cbind(epcp1$longitude,epcp1$latitude) #coordinates of homes based on postcode
#transform coordinates to same as shapefile (area level coordinates)
pts = SpatialPoints(pts, proj4string = CRS(proj4string(shapefile)))
Upvotes: 1
Views: 157
Reputation: 46
looks like you can use spTransform
from sp
. But you need to make the first SpatialPoints object with its native CRS:
pts <- cbind(epcp1$longitude,epcp1$latitude)
# assuming WGS84...
pts = SpatialPoints(pts, proj4string = CRS("+init=epsg:4326"))
pts_reproj <- spTransform(pts, CRSobj = CRS(proj4string(shapefile)))
Upvotes: 1