# How do I convert WGS84 to Lat, Long to Google Maps in R?

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.

• Where abouts are you expecting to have the point plot? Commented Jul 29, 2015 at 23:10
• When i try the coordinates on the site i mentioned i get nothing.
– toy
Commented Jul 29, 2015 at 23:15
• Do you know approximately where the point should be? Commented Jul 29, 2015 at 23:16
• It should be in NYC. But i don't know exactly where as well that's what I'm trying to find out.
– toy
Commented Jul 29, 2015 at 23:18
• It looks like you are using the wrong projection string. Try `+proj=lcc +lat_1=40.66666666666666 +lat_2=41.03333333333333 +lat_0=40.16666666666666 +lon_0=-74 +x_0=300000 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs` This is the New York Long Island State Plane in feet Commented Jul 29, 2015 at 23:34

## 1 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.