Skip to content Skip to sidebar Skip to footer

Google Maps Javascript Api Access Geojson Feature Property Explicitly

I've been working with the Google Maps Javascript API for several weeks now. I've been having trouble accessing a property of a geoJSON after it has been added to the map and becom

Solution 1:

The id of a feature is not a "property" in the meaning of geoJSON.

There is a getter-method for the id of a feature, use:

 feature.getId()//should return'country'

When you want to get a property(stored in the properties-member) use e.g.

 feature.getProperty('name')//should return'ExampleCountry'

Post a Comment for "Google Maps Javascript Api Access Geojson Feature Property Explicitly"