简体   繁体   中英

Convert coordinate system (data vs shapefile)

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:

  1. 51.40633 | 0.015208
  2. 51.40165 | 0.014715
  3. 51.40253 | 0.015171

The coordinates of the shapefile are as follows:

  1. 544173.0 | 184701.4
  2. 544180.2 | 184700.2
  3. 544180.3 | 184700.6

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)))

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)))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM