-
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
Location of markers changes incorrectly while zooming in/out #4048
Comments
Can you please provide a self-contained example that demonstrates the issue? |
It needs async calls with an internal development server, so I cannot replicate an self-contained example. but I added more explanation. Hope this helps. Let me know if it still needs clarification. Thanks a lot. |
Can you create a minimal example that doesn't depend on your internal server. For example, with test data? Without a working example of the problem, we'll likely have to close this issue, as markers behave correctly in our tests. |
I've checked that the mapbox gl css file wasn't properly linked :) now it's working. thanks! |
Just got bit by this same issue, and the solution was the same as @tanykim, basically I wasn't linking in the CSS. This is the first time I'm using Mapbox GL and I have included it in my project via npm+webpack, so it didn't occur to me to perform additional steps to include CSS since it appeared to be "working" right away - in that the map shows up and it's a map of the world. I think it would be great if the Mapbox control somehow provided a warning when CSS is missing - perhaps a |
Ups, just solved it using |
The problem for me was |
I've faced that problem today when building a React App, and I've actually created a custom function to add the function loadStyle(url) {
let index = window.document.getElementsByTagName("link")[0];
let link = window.document.createElement("link");
link.href = url;
link.rel = 'stylesheet';
index.parentNode.insertBefore(link, index);
} Now, all you need is to use that function in the proper time (Before rendering the map): loadStyle("https://api.mapbox.com/mapbox-gl-js/v1.3.0/mapbox-gl.css"); |
OH! THANKS!!!!! it helped me as well! 👍 ) |
For anyone encountering such an issue in the future: @Emixam23 You put this import statement in a JavaScript file, not in a (S)CSS file. This works if your project is set up in a way that allows importing I'm using the very nice (albeit scarcely maintained) In addition, for me the default marker's picture is centered on the given coordinates, even though it should sit north of the coordinates. Adding an |
Same here! I just removed Before, with After removing |
I solved it by adding
to the "link" in nuxt.config.js. |
if you are building an angular app, add the following to your
or for maplibre-gl:
|
I ran into this problem today and my problem was that I imported the mapbox-gl/dist/mapbox-gl.css in the component, but with a postcss compiler and tree shaking activated it was not compiled to the public css file. So I needed to import the mapbox-gl/dist/mapbox-gl.css into my main index.css of my react app. I used postcss to use tailwind, so everybody with the same setup pay attention ;) |
Hello, I am still facing this issue (marker moving on zoom-in). I already used: import 'mapbox-gl/dist/mapbox-gl.css'; in my application, it is not working. I there something related to laravel-react mix application to consider here ? or something else is missing in my case ? |
I had the same issue when using Mapbox 2.13.0, markers were moving out-of-position on some zoom levels when moving the map. Root cause: The root cause of the bug was Mapbox defaulting to a Workaround: I fixed the issue by setting the projection mode to let map = new mapboxgl.Map({
/* ... */
projection: { name: "mercator" },
}); (cc @abdul-Tz-prog) |
When I zoom the map, the marker moved the position. How to maintain the position of marker when i zoom the map? The marker is add by myself. Following is my codes.
|
v 0.31.0:
Steps to Trigger Behavior
Expected Behavior
Markers should stay in the same lat/lng no matter how the zoomed in/out
Actual Behavior
Markers are gradually aligned vertically.
![screen shot 2017-01-25 at 2 04 02 pm](https://cloud.githubusercontent.com/assets/1765649/22311690/94d35b8a-e309-11e6-8cc7-994b6aaecbac.png)
The text was updated successfully, but these errors were encountered: