[GIS] How to convert WGS84 to Lat, Long to Google Maps in R

gdallatitude longituderwgs84

I have this coordinate which I believe it's in WGS84 format

x=1005740.867110, y=243957.356623

I want to plot that in Google Maps which I need to convert that to Lon, Lat.

I've found this script but it looks like it's not working correctly.

> library(proj4)
> proj4string <- "+proj=utm +zone=19 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs "
> 
> # Source data
> xy <- data.frame(x=1005740.867110, y=243957.356623)
> 
> # Transformed data
> pj <- project(xy, proj4string, inverse=TRUE)
> latlon <- data.frame(lat=pj$y, lon=pj$x)
> print(latlon)

And I get this

        lat       lon
1 -107.8364 -14.35746

I use that lat, long and try them n http://www.darrinward.com/lat-long/ which I don't think it points to the correct point.

Best Answer

I agree with Micky T, it looks like you are using the wrong proj4 string.

First, you will need to ensure which projection your numbers are in. WGS84 is the datum, not the projection. One possible projection is UTM, which defines your starting point for your easting and northing in meters. The x and y values that you give sure look like they are a measurement in meters from one of those starting points. Take a look here to get started on figuring out which UTM zone you are in (https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system)

As noted by Micky T above, you may be in a state plane projection. For NYC I might also try UTM WGS84 19N "+proj=utm +zone=19 +ellps=WGS84 +units=m +no_defs"

Once you have your UTM zone figured out, you can search for the appropriate proj4 string from the very useful http://spatialreference.org/

Still, you are best off scouring the metadata or wherever you got those x and y coordinates from to find the exact projection.