-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Marker Click to Return Lat Lng #5397
Comments
Thanks for using Mapbox, and sorry to hear you're running into an issue. In order for us to diagnose this issue, we'll need to be able to reproduce it ourselves. Could you please create a minimal self-contained JSFiddle that demonstrates the issue? |
@jfirebaugh Alright, should have added that earlier. It isn't as great, but I think it has what is needed, and was able to see the issue using this as well. http://jsfiddle.net/Craytor/01b97w0L/75/ Please let me know if I should add anything to the fiddle. It logs the click to the console. |
Thanks. So what's the issue you're reporting, in terms of "expected result" versus "actual result"? |
I'm expecting that when I click on a marker that I can get the lat and lng of the marker so that I can find out what polygons exist at that point. Instead, what is happening is that it seems to be getting the point where you click the map, which is not necessarily the actual point of the marker (that was defined in the geojson). I was hoping that |
Inside the click handler for the |
Okay, so I am confused by |
GeoJSON data is converted to a tiled format (like vector tiles) internally, and coordinates at a given zoom level may not round trip exactly. What you're seeing is the same as #4733; closing as a duplicate. |
mapbox-gl-js version: 0.40.0
I am having a strange issue with MapBox GL. I've searched through the issues and couldn't find my exact issue.
I have markers that I have created and added to my map as a type of "circles" and I'm using the data options so I have base and stops. When I click on a maker, I expect to be able to find the lat and lng of the point in the geometry, but that is not the case. When I click on a marker from way out, I get the response that I clicked the marker (logging it to the console), but also it clicks onto a polygon (this is fine), so I can see the originating point of where I clicked. When I zoom in on a marker it is way off from a point, and therefore if I click the point again the geometry in the feature shows a different point.
Here is what I'm trying to do: click on a marker, get the marker's point (as I set in the geojson) and then find all polygons that exist at that layer.
When you think you click on the icon (the listener that listens to icon clicks says you clicked):
After you zoom in this is how far off the click was:
And finally, if you click the marker again this is what it shows:
Any suggestions would be much appreciated!
The text was updated successfully, but these errors were encountered: