shramov / leaflet-plugins

Plugins for Leaflet library
http://psha.org.ru/b/leaflet-plugins.html
MIT License
722 stars 289 forks source link

Incorrect marker position #281

Open UnsterblichMedic opened 5 years ago

UnsterblichMedic commented 5 years ago

Loads KML file. The polygon lines are all in the correct positions. The Placemarks all load but are just slightly off from the coordinates. In Google Earth they are exactly right. On Leaflet though, all of them are off by the same amount (up and to the left slightly). I am running Leaflet 1.4.0. Is this the reason why? Do I need to downgrade my Leaflet to 1.0.x or lower?

brunob commented 5 years ago

In order to help you, you should provide provide : a link to an online demo + the problematic kml file ?

UnsterblichMedic commented 5 years ago

Ok. Sorry I am new to this. I am working on it. A lot of code I am trying to figure out how to add it to JSFiddle without adding ALL of it.

UnsterblichMedic commented 5 years ago

Here is the kml file. Upon inspection, it seems the push pins have a margin-top: 3px; margin-left: -20px on initial load. Upon reload, they get margin-top: -61px; margin-left: -20px and stays at that. The other symbols don't seem to have this.

REACH 1 Google Earth.zip

UnsterblichMedic commented 5 years ago

I apologize. I have my files mixed up. The problem is with changes I made to the KML.js. I was using changes from #197 . It is rescaling the icons by "this.style.width = Math.ceil(i.width * scale) + 'px';" and it is messing it up. Sorry, still learning all of this.

UnsterblichMedic commented 5 years ago

Ok, still having the issue with the original KML.js file. After I refresh a couple times the placemarks go to the correct location. Again, it seems to have to do with the margin-left and margin-top. Those are what change after I refresh a couple times. Goes from -10px and 32px (incorrect) to -10px and -32px (correct). I don't know how to add the KML file to jsfiddle, but if you can, this code should work.

https://jsfiddle.net/UnsterblichMedic/f572mc1w/18/