I'm trying to draw points on a map and I have a problem using the projections. I have no problem getting points from longlat
to UTM
. But it seems that there is a problem when specifying UTM zone 15M and then try to plot them. I figure out that there is a difference of 10 000 000 meters
between the 2 coordinates that I had. Why is that?
library(sp)
library(mapview)
gps.pt = data.frame(lon = -90.22139,
lat = -0.6893730)
lonlat= sp::SpatialPoints(gps.pt, proj4string=CRS("+proj=longlat +datum=WGS84"))
spgeo <- sp::spTransform(lonlat, CRS("+proj=utm +zone=15M +datum=WGS84"))
# OK!
mapview::mapView(spgeo)
# Wrong map (the easting and northing values were collected from [memento][1] on an Android smartphone)
gps.pt2 = data.frame(easting = 809289.5,
northing = 9923713)
spgeo2 = sp::SpatialPoints(gps.pt2, proj4string=CRS("+proj=utm +zone=15M +datum=WGS84"))
mapview::mapView(spgeo2)
# Now OK!
gps.pt3 = data.frame(easting = 809289.5,
northing = 9923713-10000000)
spgeo3 = sp::SpatialPoints(gps.pt3, proj4string=CRS("+proj=utm +zone=15M +datum=WGS84"))
mapview::mapView(spgeo3)
Do I actually have to subtract 10 000 000 meters or I've just specified my CRS wrong? When should I apply a 10 000 000 meters correction?
proj4string=CRS("+proj=utm +zone=15M +south +datum=WGS84")
to tell the projection you're in the southern hemisphere.