Had a quik look. The javascript code looked like that of google maps and openlayers.
In the example a not closed polygon is defined. But it is shown as closed. Why? An area is made out of it. The area gets colored. How to make a polygon which is only a track (not closed, not an area)?
I was able to change the urltemplate in such a way that it grabs mapnik/osmarender tiles. Nice.
It’s just a syntactic sugar, because most of the time you want polygons closed and it assumes that. If you don’t want the area colored, just pass {fill: false} as a second argument in the Polygon constructor, or use a Polyline instead.
In the example changed
polygon = new L.Polygon(polygonPoints);
to
polygon = new L.Polyline(polygonPoints);
and ready.
If the map is clicked a popup tells the coordinates. I was wondering if doubleclicking the map would let it zoom. But it did’t. Then I removed part of the script with the onclick() function. Now zooming worked as expected.
Pretty weird for me to give up zooming for an on click function. It would be nice that both clicking and double clicking is functioning at the same timel. And in such a way that if the user doubleclicks only the doubleclick event is triggered.
Now I’m not so familiar with javascript so the questions is: how to replace all occurrences of {z} ? (Or does it so already? If so then something else is the culprit).
Having had a look at the .js file I wondered why it is so badly human readable? I would think that if this code is open source that it would be nicely formatted and hence readable.
That happens because of the popup appearance (the second click points at the popup instead of the map and so is not considered a part of double click). Thanks for reporting this problem, I’ll think what I can do with this. Created an issue for it in the issue tracker: https://github.com/CloudMade/Leaflet/issues/48 - you can track the progress there.
Further I put a polyline in it (53 points representing the border of China). Now on high zoomlevels this is shown ok. But zooming out the line schrinks to one point (where China still is about mapfilling). What is happening here?
Regarding percentages, take a look at our example: http://leaflet.cloudmade.com/examples/mobile.html (making a percentage-based block is not a Leaflet-specific problem, it’s related to the page’s CSS).
Regarding broken polyline - could you upload the test page somewhere so I could take a look?
You should replace the current /dist/leaflet.js in the “current stable” version with what’s available at http://leaflet.cloudmade.com/dist/leaflet.js . I spent HOURS trying to debug something that was fixed after reading this thread, and doing just that.
Otherwise, I’ve been pretty happy with Leaflet, and am seriously considering it as our default tool for our new mobile app.