Open alexpaullin opened 10 years ago
I have heard this issue before about Google Maps. Can you provide some code/data so that it is easier to explore the problem.
As for display lat/lon on click, the leaflet binding in rMaps
does have an option that you can enable to display lat/lon on clicking any point of the map.
map$enablePopOver(TRUE)
Example markers for buildings on a University Campus. Actual building locations: https://www.jmu.edu/map/regions/bluestone.shtml NOTE: Google Maps coordinates taken from SE corner of each building.
##FRAME
quadmap <- Leaflet$new()
quadmap$setView(c(38.438547,-78.873765), zoom = 17)
quadmap$tileLayer(provider = "MapQuestOpen.Aerial")
quadmap$params$width = 800
quadmap$params$height = 800
##MARKERS - Google Maps coordinates taken from the SE corner of each building.
quadmap$marker(c(38.439466, -78.873950), bindPopup = "<p> Spotswood Hall </p>")
quadmap$marker(c(38.439117, -78.873446), bindPopup = "<p> Sheldon Hall </p>")
quadmap$marker(c(38.438865, -78.873065), bindPopup = "<p> Alumnae Hall </p>")
quadmap$marker(c(38.438327, -78.872379), bindPopup = "<p> Keezell Hall </p>")
quadmap$marker(c(38.437878, -78.872636), bindPopup = "<p> Wilson Hall </p>")
quadmap$marker(c(38.437747, -78.873398), bindPopup = "<p> Maury Hall </p>")
quadmap$marker(c(38.437987, -78.874004), bindPopup = "<p> Jackson Hall </p>")
quadmap$marker(c(38.438218, -78.874406), bindPopup = "<p> Harrison Hall </p>")
quadmap$marker(c(38.438588, -78.874889), bindPopup = "<p> Ashby Hall </p>")
quadmap
"As for display lat/lon on click, the leaflet binding in rMaps does have an option that you can enable to display lat/lon on clicking any point of the map.
map$enablePopOver(TRUE)"
...Unfortunately it's giving me this error message:
> quadmap$enablePopOver(TRUE)
Error in envRefInferField(x, what, getClass(class(x)), selfEnv) :
‘enablePopOver’ is not a valid field or method name for reference class “Leaflet”
I've been doing some research. It seems to have something to do with Leaflet displaying coordinates in the EPSG:3857 projection, whereas Google Maps and MapQuest are writing out their coordinates in the spherical geographic coordinate system EPSG:4326. Is there a command/line of code I can use in rMaps to convert EPSG:4326 coordinates to EPSG:3857?
Sorry for crowding this thread, but I found this thread regarding the same issue, which you responded to. Your 'rounding' conclusion makes a whole lot of sense in my case, too. I've been using another service to acquire more accurate coordinates to 15 decimal places, and although the markers often appear slightly closer to the phenomena in question, many of them 'snap to a grid' which is likely created by rounding off the ends of the coordinates. After playing around a bit, it seems to be they are being lopped off after 4 decimal points.
So, it appears from the other thread that you are already working on this. Any news? Thank you very much!
Initially I was plotting coordinates taken from Google Maps with Leaflet "markers," but I realized the coordinates are not lining up, sometimes drastically so. To be more consistent, I then took coordinates from MapQuest and plotted them on top of a MapQuest tileset in rMaps Leaflet. No dice.
To bypass this, I hoped to find coordinates WITHIN Leaflet, which led me to desire the ability to display lat/long coordinates at any clicked location. An example in Leaflet API is linked below. This would be very cool. Is there a way to translate this to rMaps?
http://gis.stackexchange.com/questions/39055/how-to-get-the-lat-long-of-a-clicked-location-using-leaflet-api
Also, is my overall coordinate matching problem uncommon, and is it fixable in and of itself? Thanks!