Skip to content
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

Markers added far away from the initial Map Center never show on the map #2879

Closed
adcooley opened this issue Jul 15, 2016 · 5 comments
Closed

Comments

@adcooley
Copy link

mapbox-gl-js version: 0.21.0

Steps to Trigger Behavior

  1. Open the jsbin: https://jsbin.com/riguyowutu/1/edit?html,css,output
  2. I only slightly modified the Marker().addTo(map) example in the docs. You'll notice I'm adding two icons, but only the one near the initial map center is showing. The other will never show.
  3. Swap the initial center for the map (using the commented code) to see that the other will now show.

Expected Behavior

I expect all Markers added (especially when there are only 2) to show on the map when within the viewing range.

Actual Behavior

Only markers added near the inital Map center are showing. I've tested adding a lot to both vicinities and multiple will show, but only near the initial center.

@jfirebaugh
Copy link
Contributor

I'm seeing both markers:

image

Perhaps you are looking 360 degrees to the east or west of this view? Markers do not automatically repeat themselves across the antimeridian; if you desire that behavior you'll need to add multiple copies of the marker.

@peterqliu
Copy link
Contributor

if you desire that behavior you'll need to add multiple copies of the marker.

@adcooley alternately, you can set lnglat bounds to the map so that it never pans past where you'd like the markers to be

@adcooley
Copy link
Author

@jfirebaugh I'd love to be able to reproduce the correct behavior… if I open the above jsbin, wait for the map to load, and zoom straight out, only one icon is visible.

I think I see what you mean about moving 360 deg, but i assumed if I head in one direction, I would see the 2nd icon before reaching the non-repeated first icon again.

@adcooley
Copy link
Author

@peterqliu I'll give that a go too, thanks!

@adcooley
Copy link
Author

@jfirebaugh I understand now, took me a bit to grasp what was going on.

I think the reason I was so confused is that when I add a layer source with 'symbol features', they are re-added to the map automatically as you scroll in either direction, whereas the Markers are not. For now I've worked up a solution that checks moveend and removes/re-adds Markers with the appropriate +-360 offset. Would love for this feature to be handled automatically!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants