Leaflet — a new open source JavaScript library for maps by CloudMade

hi mourner…great work on leaflet. How do I use mapnik or opencycle as the basemap? am I limited to cloudmade tiles?

I have tried on local tiles made by mapnik, thank you. Sergey.
(опробовал на локальных тайлах, сделаных мапником, спасибо за работу)

Simply change a format of record in the address of a server on necessary in html-file of a map.
For mapnik :

var cloudmadeUrl = 'http://yourserver_of_mapnik_tiles/{z}/{x}/{y}.png',

Regards, Sergey


I try to add Permalink Function to leaflet.
I found this : https://github.com/shramov/Leaflet/commit/3eed58e157685da2b9e4bcc3c2f3e9f1af78e8c6
I upload .js and add map.addControl(new L.Control.Permalink()) but it doesnt work : http://carte.lavilleavelo.org/
When i click “Permalink” the map disappear.

Has anybody an idea to help ? Thank You.

Why not refer to http://www.lavilleavelo.org/carte/lvv2.html and if you took the pagetracker script out there would be even less code to look at. Please keep the problem as simple as possible.

Clicking the Permalink gives:
and the map is empty.

Apparently you have to do something with the zoom, lat and lon parameters. I don’t know what because I did not look to much at the source. Think you omitted a piece of javascript.

I tried with unknown parameter xzoom, xlat, and ylon.
Then the map is shown.

So the script really does something wit known parameters.

What you should do - i think- is take out the line

	map.setView(new L.LatLng(45.76, 4.835), 14).addLayer(cloudmade);

(this line is always the same even if you move the map first to a new position)

and replace that with something like

	map.setView(new L.LatLng(lat, lon), zoom).addLayer(cloudmade);

Did you follow the example?

Thank you for your answer.

When i Click one time on the “Permalink” link, after i zoomed, here is the URL show for example in URL bar : http://www.lavilleavelo.org/carte/lvv2.html?zoom=17&lat=45.760154&lon=4.84909

And the map is not show.

But when i click a second time on “Permalink” link, the URL change : http://www.lavilleavelo.org/carte/lvv2.html?zoom=17&lat=45.760154&lon=-175.15091 and the Permalink is good. In fact, only the longitude change, and i dont understand at all. The right value for longitude is in the first URL but this is the second value (-175.15091 for example) which works.

When i add this line : map.setView(new L.LatLng(lat, lon), zoom).addLayer(cloudmade);
it doent work.

If this was OpenLayers you could use something like:

var lon = 16831422;
var lat=-4012608;
var zoom = 3;

            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);

You could try the GetCenter() (a lot of functions in leaflet seem to have the same names).

do I understand correctly that leaflet is somethink like openlayers ?

Can it do more than OL or what are the advantages ?



Chris please read the first post in this thread by Mourner and follow the link(s).

Thank you green caps. I have actually reinstall OpenLayers for the moment, in order to find the problem (and another).


I think that leaflet is an excellent and simple web mapping library and now there are many plugins that have been developed
pointing you to a couple of two very useful plugins that I developed with the help of other programmers on github: