HereMaps GeoJSON Polygon Click Read Properties
my question is as follows. What I have I have a GeoJSON feature collection with Polygons and custom properties GeoJSON is loaded into the Here maps What I want I want to detect
Solution 1:
Here is the example code to get the property value of the GeoJSON Polygon on click.
reader = new H.data.geojson.Reader('/path/to/geojson/file.json');
reader.parse();
map.addLayer(reader.getLayer());
reader.getLayer().getProvider().addEventListener("tap", function(e) {
if(e.target instanceof H.map.Polygon) {
console.log('Custom property value: ', e.target.getData().properties.customProp);
}
});
GeoJSON documentation can be found here: https://developer.here.com/documentation/maps/topics_api/h-data-geojson-reader.html
Post a Comment for "HereMaps GeoJSON Polygon Click Read Properties"