makinacorpus / Leaflet.FileLayer

Loads files locally (GeoJSON, KML, GPX) as layers using HTML5 File API
http://makinacorpus.github.io/Leaflet.FileLayer/
MIT License
271 stars 91 forks source link

Why can't I write like this? How should I revise it? #80

Open 2qq2qq opened 3 years ago

2qq2qq commented 3 years ago

Why can't I write like this? How should I revise it?

var control = L.Control.fileLayerLoad({ fitBounds: true, layerOptions: { onEachFeature: function (feature, layer) { if (feature.properties.name) { layer.bindTooltip(feature.properties.name, { permanent: true }) };

//if (feature.properties.name) { layer.bindTooltip([latlng], { permanent: true }) }; },

pointToLayer: function (data, latlng) { return L.circleMarker(latlng, {style: style});

control.loader.on('data:loaded', function (event) { // event.layer gives you access to the layers you just uploaded!

    // Add to map layer switcher
    layerswitcher.addOverlay(event.layer, event.filename);
});

}} });

control.addTo(map);