Is there a way to associate a GeoJson with a click event?
const features = map.data.addGeoJson(json);
for (const feature of features) {
// Add styling
map.data.overrideStyle(
feature,{
fillColor: 'red',
});
// TODO: Add a click handler for "feature"
}
For normal entities, such as LatLngBounds
, there seems to be addListener(instance, eventName, handler)
. This does however not exist for the feature from the snippet above.
Is there an equivalent alternative for geojson features?
Nevermind, I just found this help page, which gives a snippet on how to do this: