leaflet-plugins icon indicating copy to clipboard operation
leaflet-plugins copied to clipboard

Incorrect marker position

Open UnsterblichMedic opened this issue 6 years ago • 5 comments

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?

UnsterblichMedic avatar Feb 21 '19 00:02 UnsterblichMedic

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

brunob avatar Feb 22 '19 15:02 brunob

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 avatar Feb 22 '19 17:02 UnsterblichMedic

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 avatar Feb 22 '19 21:02 UnsterblichMedic

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 avatar Feb 22 '19 22:02 UnsterblichMedic

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/

UnsterblichMedic avatar Feb 24 '19 19:02 UnsterblichMedic