displaying styles stored in a geojson file and making lines appear as lines instead of markers

Change your code to:

function onEachFeature(feature, layer) {
    if (feature.properties && layer instanceof L.Path) {
            color: feature.properties.pen,
            weight: feature.properites.weight

$.getJSON(address, function(data) {
    //add GeoJSON layer to the map once the file is loaded
    layer[i] = L.geoJson(data, {
        onEachFeature: onEachFeature

Leaflet GeoJson Tutorial

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top