Select to view content in your preferred language

Open Street Map and Leaflet (L.tileLayer) ??

3662
2
08-05-2015 01:53 PM
Labels (1)
JamesFitzgerald
Frequent Contributor

Hello,

Question: How do I link to Open Street Map (OSM)? Do I have to export the png file from Open Street? Do i have to reference it from OSM?

 

var startPoint = [34.227700, -84.250717];
var map = L.map('map', {attributionControl: false, editInOSMControl: true, editInOSMControlOptions: {position: 'topleft'}}).setView(startPoint, 17),
    tilelayer = L.tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {maxZoom: 20, legend: LEGEND, openLegendOnLoad: true, attribution:osmDataAttr}).addTo(map),
    hash = new L.Hash(map);
    legend = (new L.Control.TileLegend()).addTo(map);
    // legend = new L.TileLegend(map, tilelayer, L.DomUtil.get('leaflet-control-tilelegend-container'), LEGEND);
    // legend.open();
</script>
0 Kudos
2 Replies
JohnGravois
Deactivated User

i don't understand your question.  can you clarify please?

you can find a working example of a loading a hosted OSM basemap using L.tileLayer here:

http://esri.github.io/esri-leaflet/examples/geocoding-control.html

JamesFitzgerald
Frequent Contributor

John,

Thanks for your reply! I had the correct syntax. The problem occurred in my browser. I refreshed, and it is working now. Thanks again for the help!

0 Kudos