leaflet-kmz
leaflet-kmz copied to clipboard
GroundOverlay alignment differs from Google Earth
I have some KML and KMZ files that show different in google earth than in leaflet. The alignment is off on the leaflet map. Is there something I should check?
Hi marct83, please if you are looking for help you must provide as much information as possible (a working demo describing the issue, some screenshots, code samples, ...). The most likely thing is that the file you use is saved in a different coordinate system (the lat-lng order may also give you some problems).
Have a nice day, Raruto
I thought it might be something simple. I can provide more details.
This is the kmz in google earth:

This is the kmz in my leaflet app:

You can see its shifted to right and up in the leaflet app. The shaded areas should be over top of the town names.
I have included the file (.kmz) (I had to rename it to zip so it would upload).
Given the extent of the mapped area I think there could be an excessive approximation performed by leaflet itself.
To be clear, the following is pretty much all the code used to handle GroundOverlays:
https://github.com/Raruto/leaflet-kmz/blob/29057ad537aaf3bfad89b49fb60376929524e89e/src/KMZLayer.js#L132-L139
https://github.com/Raruto/leaflet-kmz/blob/29057ad537aaf3bfad89b49fb60376929524e89e/src/utils.js#L97-L117
https://github.com/Raruto/leaflet-kmz/blob/29057ad537aaf3bfad89b49fb60376929524e89e/src/KMZImageOverlay.js#L6-L34
I recommend that you use the geometryToLayer option to try to find out the cause of this problem (you can also use it to completely override the built-in parser if you want), otherwise, try asking on dedicated forums like gis.stackexchange.com or stackoverflow.com (I apologize but honestly I have no idea what the causes could be 🤷).
Reference:
- https://github.com/Raruto/leaflet-kmz/issues/11#issuecomment-669612399
- https://github.com/Raruto/leaflet-kmz/issues/13#issuecomment-674011149
- https://github.com/Raruto/leaflet-kmz/issues/10#issuecomment-662365763
Raruto
PS if it can help, you can also take a look at this library as well: https://github.com/ahalota/Leaflet.KMLGroundOverlay