• Hi, I would like to add to my map a layer that marks some districts so my users, aftar looking for an address, can see in which district is located.

    I have a correctly form geojson file (link) but i am trying multiple ways to load that file and none works.

    L.GeoJSON(MYJSON);
    L.GeoJSON(MYJSON).addTo(map);
    L.GeoJSON(MYJSON).addTo(leaflet);

    any ideas?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Thread Starter Jaime Pérez Dans

    (@perezdans)

    Finally i managed to acomplish this way:

    jQuery(document).on(‘acf-osm-map-init’,function(e){
    var map = e.detail.map;

    L.geoJSON(geojsondata, {
    style: function (feature) {
    return {
    “color”: feature.properties.color,
    “opacity”: 1,
    “weight”: 2,
    “fillColor”: feature.properties.color,
    “fillOpacity”: 0.2
    };
    }
    }).bindPopup(function (layer) {
    return layer.feature.properties.name;
    }).addTo(map);
    });

Viewing 1 replies (of 1 total)
  • The topic ‘Adding a custom geojson layer’ is closed to new replies.