-
Notifications
You must be signed in to change notification settings - Fork 134
Markers not showing in second (or more) maps #345
Comments
This is happening to me as well, though which map gets the marker seems to be random. |
I figured out some additional details about what is going on here. On processing the markers for the first map,
(markers.js:267-271) ...from blocking I have no idea what In any case, for our simple maps that don't do much with events, simply commenting out |
i had similar problem, but in my project, markers don't show , when i display map second (or more) time.
|
Sorry to not provide feedback for so long, but I have long moved on from angular unless working on legacy projects. The main problem boils down to how leafletData is designed. It is a main bottleneck that can have race conditions and lose track of the map and or markers state themselves. This limitation would require an entire rewrite which at this point is not worth the effort. Main reason being is that I am not using this library for work purposes any longer. For getting multiple maps to work correctly you're going to want to implement a manager that maps DOM id's to the specific map instance. An example: utilized here: |
I make an angular component to display one map with a marker, the problem was that if the component was called more than one time (more than one map is displayed on the screen), the marker only appears in the first map instance, but, the map is centerd correctly, so... something strange is happening. (A screen capture is attached at the end of the issue, its labeled as 'Capture 1').
I don't know where the problem can be, so I started to simplify my code up to:
The markers are shown only in the first map!.
A screen capture is attached at the end of the issue (Labeled as 'Minimal example'
(I know the markers should be declared in the controller, but I put them in the html to make the example easier).
I went to
ui-leaflet
examples to find something that can helps me, but... In the examples the markers are not working too!The same marker should appear in both maps (same markers variable in controller), but it appears only in the first one.
Each map has its own markers (markers1 and markers2 in the controller), but the coordinates of the markers are identical. The markers should appear in both maps, but they are shown only in the first one. I noticed that
geojson
data are displayed in both maps...This example is not working in github by now, I implemented it in my project and the same problem happend.
I checked that this problem happens to me with branches
leaflet-1.X
(this is the branch I'm using) andmaster
.Screen captures:
The text was updated successfully, but these errors were encountered: