leaflet kmz

1,018 views
Skip to first unread message

Ricardo Deus

unread,
Jun 3, 2014, 2:16:14 PM6/3/14
to leafl...@googlegroups.com
Hello all
I new user of leaflet.
During one of my tests i try to use a example of a kmz file, from a radar image from Portugal area.
But something is wrong in the position of the image.
Can i get some help.

best regards 

KMZ-radar.html
lis_maxz_20140104_0000.kmz

Olav Peeters

unread,
Jun 4, 2014, 7:26:12 AM6/4/14
to leafl...@googlegroups.com, Ricardo Deus
Ricardo,
I see that you sometimes a comma instead of a full-stop in your coordinates..
See attached html
Also, I would not do something like  -04.210102 but rather  -4.210102

I cannot test since I don't have all dependencies in place..

Cheers,
Olav
--

---
You received this message because you are subscribed to the Google Groups "Leaflet" group.
To unsubscribe from this group and stop receiving emails from it, send an email to leaflet-js+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

KMZ-radar.html

Ricardo Deus

unread,
Jun 4, 2014, 7:38:53 AM6/4/14
to leafl...@googlegroups.com, ricardo....@gmail.com


Hi Olav
Thank you for the answer.
You correct with the attach that i send you can not test it.
I prepared a zip file with the dependencies.
best regards
RD
sa-example.zip

Ricardo Deus

unread,
Jun 5, 2014, 10:23:46 AM6/5/14
to leafl...@googlegroups.com, ricardo....@gmail.com
Hello Olav
I think i found one the problems.
The points in the kml have , for N and S points and .  W and E, for decimal values.

var marker = new L.Marker([42.52219772338867, -4,210102 ]).addTo(point);
var marker2 = new L.Marker([42.52219772338867, -11,869027 ]).addTo(point);

After the correction the image became almost correct. (new kmz in attached) 
We get well position points at the North and south part of the overlay, but in the center its not good. See image.
Any ideas 
best regards
RD
teste_image_radar.png
radar.kmz-new3.kmz

Olav Peeters

unread,
Jun 5, 2014, 10:51:17 AM6/5/14
to leafl...@googlegroups.com, ricardo....@gmail.com
Hi Ricardo,
I assumed your issue was fixed. Attached a screenshot of what I was getting.. Looked fine to me.
On closer inspection, indeed the KML should be:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:xal="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0" xmlns:gx="http://www.google.com/kml/ext/2.2">
<GroundOverlay>
<name>lis_maxz_0000</name>
<Icon>
<href>lis_maxz_0000.png</href>
</Icon><LatLonBox>
<north>42.52219772338867</north>
<south>35.561622619628906</south>
<east>-4.210102</east>
<west>-11.869027</west>
</LatLonBox>
</GroundOverlay>
</kml>

If I understand you correctly the image is distorted in the centre? Probably a projection issue.. What projection is your PNG? The KML is assuming EPSG:4326 (WGS84) which is a geographic system (an xy on a globe). If your PNG is in a (Portugees national?) projected (2d representation of a globe) system the centre of the image will indeed be distorted. In Leaflet you can convert the one to the other, but you need to define the originally projection correctly.
See:
http://leafletjs.com/reference.html#iprojection
and
http://leafletjs.com/reference.html#icrs

Cheers,
Olav
Screen Shot 2014-06-05 at 16.32.48.jpg
Reply all
Reply to author
Forward
0 new messages