Skip to main content
added 91 characters in body
Source Link
Barbarossa
  • 5.8k
  • 1
  • 28
  • 62

You can use the .bindPopup() method to bind a desired attribute to the popup, with the use of an .onEachFeature() function. See below. Examples can be found here.

function onEachFeature(feature, layer) {
    if (feature.properties && feature.properties.NAME) {
        layer.bindPopup(feature.properties.NAME);
    }
}

geojsonFeaturesfunction =addDataToMap(data, "county_coords.geojson"
map) {
    L.geoJSONgeoJson(geojsonFeaturesdata, {
        onEachFeature: onEachFeature
    }).addTo(map);   
}

$.getJSON("county_coords.geojson", function(data) { 
    addDataToMap(data, mymap); 
});

You can use the .bindPopup() method to bind a desired attribute to the popup, with the use of an .onEachFeature() function. See below. Examples can be found here.

function onEachFeature(feature, layer) {
    if (feature.properties && feature.properties.NAME) {
        layer.bindPopup(feature.properties.NAME);
    }
}

geojsonFeatures = "county_coords.geojson"

L.geoJSON(geojsonFeatures, {
    onEachFeature: onEachFeature
}).addTo(map);

You can use the .bindPopup() method to bind a desired attribute to the popup, with the use of an .onEachFeature() function. See below. Examples can be found here.

function onEachFeature(feature, layer) {
    if (feature.properties && feature.properties.NAME) {
        layer.bindPopup(feature.properties.NAME);
    }
}

function addDataToMap(data, map) {
    L.geoJson(data, {
        onEachFeature: onEachFeature
    }).addTo(map);   
}

$.getJSON("county_coords.geojson", function(data) { 
    addDataToMap(data, mymap); 
});
added 5 characters in body
Source Link
Barbarossa
  • 5.8k
  • 1
  • 28
  • 62

You can use the .bindPopup() method to bind a desired attribute to the popup, with the use of an onEachFeature.onEachFeature() function. See below. Examples can be found here.

function onEachFeature(feature, layer) {
    if (feature.properties && feature.properties.NAME) {
        layer.bindPopup(feature.properties.NAME);
    }
}

geojsonFeatures = "county_coords.geojson"

L.geoJSON(geojsonFeatures, {
    onEachFeature: onEachFeature
}).addTo(map);

You can use the .bindPopup method to bind a desired attribute to the popup, with the use of an onEachFeature function. See below. Examples can be found here.

function onEachFeature(feature, layer) {
    if (feature.properties && feature.properties.NAME) {
        layer.bindPopup(feature.properties.NAME);
    }
}

geojsonFeatures = "county_coords.geojson"

L.geoJSON(geojsonFeatures, {
    onEachFeature: onEachFeature
}).addTo(map);

You can use the .bindPopup() method to bind a desired attribute to the popup, with the use of an .onEachFeature() function. See below. Examples can be found here.

function onEachFeature(feature, layer) {
    if (feature.properties && feature.properties.NAME) {
        layer.bindPopup(feature.properties.NAME);
    }
}

geojsonFeatures = "county_coords.geojson"

L.geoJSON(geojsonFeatures, {
    onEachFeature: onEachFeature
}).addTo(map);
Source Link
Barbarossa
  • 5.8k
  • 1
  • 28
  • 62

You can use the .bindPopup method to bind a desired attribute to the popup, with the use of an onEachFeature function. See below. Examples can be found here.

function onEachFeature(feature, layer) {
    if (feature.properties && feature.properties.NAME) {
        layer.bindPopup(feature.properties.NAME);
    }
}

geojsonFeatures = "county_coords.geojson"

L.geoJSON(geojsonFeatures, {
    onEachFeature: onEachFeature
}).addTo(map);