When loading a geoJSON file into a Google map as a data layer, how can I access the properties of the data layer itself?
I know how to access individual properties like posts_here in the example below. What I'm looking for is the properties of the layer itself - in this example maxPosts .
$.getJSON("http://example.com/posts/grid.json" + location.search, function (data) { grid = map_canvas.data.addGeoJson(data); map_canvas.data.setStyle(function(feature) { return ({ strokeWeight: Math.log(feature.getProperty('posts_here')), }); }) });
grid.json example Download:
{ "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [-58,-35], [-58,-34], [-57,-34], [-57,-35], [-58,-35] ] ] }, "properties": { "posts_here": "177" } } ], "properties": { "maxPosts": "177" } }
source share