0

I uploaded a GeoJson file into GMaps API that has many polygon features in it, and now I'd like to create a pop up for each polygon. The content will be obtained from the attribute table of the GeoJson file from a field called "NAME".

Do you have a hint how to do that?enter image description here

1
  • Use a click listener and retrieve the data of that polygon to set the content of the infowindow. Have a look at this post link
    – eltomaco
    Commented Jun 7, 2016 at 8:59

1 Answer 1

0

This is a follow up answer. The quick way to do it is to use a listener event and extract values for each polygon using

event.feature.H.ATTRIBUTE_FIELD;

So, in my case it ended up as the following?

Cities.addListener('click', function(event) {
    var str = event.feature.H.NAME;
    infowindow.setContent(str);
    infowindow.setPosition(event.LatLng());
    infowindow.open(map);
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.