GeoJSON - information for a point?
consideRatio opened this issue · 4 comments
Is GeoJSON supposed to show information if click / hover over a point?
For example, in jupyterlab/jupyterlab-demo, there is a .geojson file showing museum map locations and there is a lot of information about them, but from the mapview it is hidden. Is my GeoJSON extension failing, or is it not something that is implemented?
I notice that on GitHub, the geojson previewer allows for viewing information about the point on the map.
GitHub preview of the file
My GeoJSON extension installation in action
The implementation is pretty simple so I think it's just not implemented (unless all of that can be encoded in the GeoJSON and leaflet just knows what to do with it).
I think changing this line in the code to the below snipped should solve this issue:
this._geoJSONLayer= leaflet.geoJSON(data, {
onEachFeature: function (feature, layer) {
if (feature.properties) {
var popupContent = '<table>';
for (var p in feature.properties) {
popupContent += '<tr><td>' + p + ':</td><td><b>' + feature.properties[p] + '</b></td></tr>';
}
popupContent += '</table>';
layer.bindPopup(popupContent);
}
}
}).addTo(this._map);
That looks good to me @adriantre, care to make a PR?
Done!