0

In order to create an interactive map consisting of several layers I use the plugin leaflet-ajax with downloading of the files. geojson. When you direct at the object of the layer, the attribute information (objects attributes) displays. It is required to include a link to the html page in a number of the objects attributes. I rack my brains over this task a week, please, help me know how to do it! The code is given below.

   {
    "type": "FeatureCollection",
    "crs": {
        "type": "name",
        "properties": {
            "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
        }
    },

    "features": [{
        "type": "Feature",
        "properties": {
            "id": 2,
            "date": "2012\/02\/05",
            "material": "plastic",
            "Number": 1,
            "support,feeder": "2 2"
        },
        "geometry": {
            "type": "MultiPoint",
            "coordinates": [
                [34.377387101428354, 54.063054027736584]
            ]
        }
    }, {
        "type": "Feature",
        "properties": {
            "id": 4,
            "date": "2012\/02\/05",
            "material": "plastic",
            "Number": 1,
            "support , feeder": "4 2"
        },
        "geometry": {
            "type": "MultiPoint",
            "coordinates": [
                [34.378052287959541, 54.062481025595972]
            ]
        }
    }, ]
}
2
  • Define what you mean by "interactive". Leaflet allows you out-of-the-box to create popups (when hovering or clicking an area or marker) or to bind a (javascript) function to an event.
    – Paul
    Commented Feb 27, 2016 at 10:36
  • 213.137.240.143:7778/rcs_8/index1.html when the mouse cursor and clicking on a marker
    – dimaolin
    Commented Feb 27, 2016 at 10:50

1 Answer 1

0

Looks like this is happening because you are never actually adding the layers to the map. Make sure to add map.addLayer(dorogi) for each one of those AJAX layers after you initialize them.

Or you can watch the data:loaded event and add them after all data has been downloaded. Docs at https://github.com/calvinmetcalf/leaflet-ajax

Not the answer you're looking for? Browse other questions tagged or ask your own question.