Skip to main content
added 171 characters in body
Source Link
Cliff
  • 129
  • 1
  • 11

I have a Leaflet map. To the map I load two JavaScript files (A.js & B.js) which both consist of only polygons. Now my aim is, that when I click inside Leaflet on one of the polygons, that I get a popup showing the area of that polygon. The area is saved in the JavaScript file under Shape_Area.

"type": "Feature", 
"properties": { "OBJECTID": 1, "Id": 1, "gridcode": 1, "Shape_Leng": 1805.0000000099999, "Shape_Area": 8781.24999991, "LandUse": "Urban" }

My code until now is:

function onEachFeature(feature, layer) {
                if (feature.properties && feature.properties.NAME) {
                        layer.bindPopup(feature.properties.NAME);
                    }   
            }
var LayerA = L.geoJSON(UF,{style: style},{onEachFeature: function(feature, layer) {layer.bindPopup(feature.properties.type);}}).addTo(mymap);;
LayerA.eachLayer(function (layer) {layer.bindPopup(UF.Shape_Area);});

I get already my popup, but I do not know how to exactly get the Shape_Area of my my JavaScript-file.

Anybody has a hint for that please?

I have a Leaflet map. To the map I load two JavaScript files (A.js & B.js) which both consist of only polygons. Now my aim is, that when I click inside Leaflet on one of the polygons, that I get a popup showing the area of that polygon. The area is saved in the JavaScript file under Shape_Area.

My code until now is:

function onEachFeature(feature, layer) {
                if (feature.properties && feature.properties.NAME) {
                        layer.bindPopup(feature.properties.NAME);
                    }   
            }
var LayerA = L.geoJSON(UF,{style: style},{onEachFeature: function(feature, layer) {layer.bindPopup(feature.properties.type);}}).addTo(mymap);;
LayerA.eachLayer(function (layer) {layer.bindPopup(UF.Shape_Area);});

I get already my popup, but I do not know how to exactly get the Shape_Area of my JavaScript-file.

Anybody has a hint for that please?

I have a Leaflet map. To the map I load two JavaScript files (A.js & B.js) which both consist of only polygons. Now my aim is, that when I click inside Leaflet on one of the polygons, that I get a popup showing the area of that polygon. The area is saved in the JavaScript file under Shape_Area.

"type": "Feature", 
"properties": { "OBJECTID": 1, "Id": 1, "gridcode": 1, "Shape_Leng": 1805.0000000099999, "Shape_Area": 8781.24999991, "LandUse": "Urban" }

My code until now is:

function onEachFeature(feature, layer) {
                if (feature.properties && feature.properties.NAME) {
                        layer.bindPopup(feature.properties.NAME);
                    }   
            }
var LayerA = L.geoJSON(UF,{style: style},{onEachFeature: function(feature, layer) {layer.bindPopup(feature.properties.type);}}).addTo(mymap);;
LayerA.eachLayer(function (layer) {layer.bindPopup(UF.Shape_Area);});

I get already my popup, but I do not know how to exactly get the Shape_Area of my JavaScript-file.

Anybody has a hint for that please?

Post Closed as "Needs details or clarity" by IvanSanchez, whyzar, Andre Silva, nmtoken, ahmadhanb
deleted 134 characters in body
Source Link
Bera
  • 77.8k
  • 14
  • 78
  • 187

I am a bit lost on Leaflet. My problem consists of that I cannot find any informations on how to handle this.

I have a Leaflet map. To the map I load two JavaScript files (A.js & B.js) which both consist of only polygons. Now my aim is, that when I click inside Leaflet on one of the polygons, that I get a popup showing the area of that polygon. The area is saved in the JavaScript file under Shape_Area.

I am totally lost on this. My code until now is:

function onEachFeature(feature, layer) {
                if (feature.properties && feature.properties.NAME) {
                        layer.bindPopup(feature.properties.NAME);
                    }   
            }
var LayerA = L.geoJSON(UF,{style: style},{onEachFeature: function(feature, layer) {layer.bindPopup(feature.properties.type);}}).addTo(mymap);;
LayerA.eachLayer(function (layer) {layer.bindPopup(UF.Shape_Area);});

I get already my popup, but I do not know how to exactly get the Shape_Area of my my JavaScript-file. 

Anybody has a hint for that please?

I am a bit lost on Leaflet. My problem consists of that I cannot find any informations on how to handle this.

I have a Leaflet map. To the map I load two JavaScript files (A.js & B.js) which both consist of only polygons. Now my aim is, that when I click inside Leaflet on one of the polygons, that I get a popup showing the area of that polygon. The area is saved in the JavaScript file under Shape_Area.

I am totally lost on this. My code until now is:

function onEachFeature(feature, layer) {
                if (feature.properties && feature.properties.NAME) {
                        layer.bindPopup(feature.properties.NAME);
                    }   
            }
var LayerA = L.geoJSON(UF,{style: style},{onEachFeature: function(feature, layer) {layer.bindPopup(feature.properties.type);}}).addTo(mymap);;
LayerA.eachLayer(function (layer) {layer.bindPopup(UF.Shape_Area);});

I get already my popup, but I do not know how to exactly get the Shape_Area of my JavaScript-file. Anybody has a hint for that please?

I have a Leaflet map. To the map I load two JavaScript files (A.js & B.js) which both consist of only polygons. Now my aim is, that when I click inside Leaflet on one of the polygons, that I get a popup showing the area of that polygon. The area is saved in the JavaScript file under Shape_Area.

My code until now is:

function onEachFeature(feature, layer) {
                if (feature.properties && feature.properties.NAME) {
                        layer.bindPopup(feature.properties.NAME);
                    }   
            }
var LayerA = L.geoJSON(UF,{style: style},{onEachFeature: function(feature, layer) {layer.bindPopup(feature.properties.type);}}).addTo(mymap);;
LayerA.eachLayer(function (layer) {layer.bindPopup(UF.Shape_Area);});

I get already my popup, but I do not know how to exactly get the Shape_Area of my JavaScript-file. 

Anybody has a hint for that please?

Source Link
Cliff
  • 129
  • 1
  • 11

Leaflet: popup showing information on the polygon

I am a bit lost on Leaflet. My problem consists of that I cannot find any informations on how to handle this.

I have a Leaflet map. To the map I load two JavaScript files (A.js & B.js) which both consist of only polygons. Now my aim is, that when I click inside Leaflet on one of the polygons, that I get a popup showing the area of that polygon. The area is saved in the JavaScript file under Shape_Area.

I am totally lost on this. My code until now is:

function onEachFeature(feature, layer) {
                if (feature.properties && feature.properties.NAME) {
                        layer.bindPopup(feature.properties.NAME);
                    }   
            }
var LayerA = L.geoJSON(UF,{style: style},{onEachFeature: function(feature, layer) {layer.bindPopup(feature.properties.type);}}).addTo(mymap);;
LayerA.eachLayer(function (layer) {layer.bindPopup(UF.Shape_Area);});

I get already my popup, but I do not know how to exactly get the Shape_Area of my JavaScript-file. Anybody has a hint for that please?