I have generated a leaflet map with gdal2tiles out of my rasters and it works wonderful. Now I want to add my shapes in form of GeoJSONs and I have my difficulties.

To the gdal2tiles generated script, first I assign a variable to my geojson and show the location of it.

// GeoJSON
var Pad = L.geoJSON('./Padarchol/Padarchol.geoJSON');

Than I gather all my geoJSONs under one var, like it is done with the basemaps and the overlaymaps.

var shapes = {"Padarchol": Pad,}

In the end I add all of those layers

L.control.layers(basemaps, overlaymaps, shapes {collapsed: false}).addTo(map);

Result is a blank page. Without these addings leaflet presents me a wonderful map...

  • 1
    Does anythig show in the browser error console? In Firefox, press F12 to open it. – til_b May 18 '17 at 10:02
  • SyntaxError: missing ) after argument list leaflet.html:100:55. and this is the line L.control.layers(basemaps, overlaymaps, shapes {collapsed: false}).addTo(map); – Leo May 18 '17 at 10:15
  • okay I added a comma after "shapes". Now it says: "L.geoJSON is not a function" – Leo May 18 '17 at 10:18
  • 3
    L.geoJSON with Leaflet 1.x, L.geoJson with Leaflet 0.x (pay attention to the case) – ghybs May 18 '17 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.