I am trying to use data imported through one of the google maps/Bing API, and am confused about the projection. Using the APIs, data comes under a non-geographic format, such as json or xml, try:
http://maps.googleapis.com/maps/api/geocode/json?address=Davis&sensor=false
It seems that the projection of google maps is epsg:3857. However, according to this stack post and this page, things are more complicated:
All of this further confused by that fact that often even though the map is in Web Mercator(EPSG: 3857), the actual coordinates used are in lat-long (EPSG: 4326).
So what should I do, when I import a point, and want it, say in the final projection WGS 84 (epsg:4326)? I tried:
- Declaring as 3857, then converting to 4326: gives me a point out of space (see
point_3857_to_4326
in code below: -0.00109, 0.00034) - Declaring directly as 4326: seems to make sense (see
point_4326
)
Where is the issue? That the points themselves are not in 3857, or that they are, but conversion is not well done? This post indicates in chapter "the solution" how to do the conversion, but I just don't get it...
Example with R:
# not run: library(ggmap)
# geocode("Davis", output="latlon")
library(sf)
point <- st_point(c(-121.7405167, 38.5449065))
point_4326 <- st_sfc(point, crs=4326)
point_3857_to_4326 <- st_sfc(point, crs=3857) %>%
st_transform(4326)
point_4326
point_3857_to_4326