Bir geoJSON dosyasını bir veri katmanı olarak bir Google Map'e yüklerken, veri katmanının özelliklerine nasıl erişilir?Google Haritalar'da bir GeoJSON veri katmanının özelliklerini kullanma V3
Aşağıdaki örnekte,gibi access the individual properties'u nasıl biliyorum. Bu örnekte, bu örnekte, maxPosts
, katmanın kendisinin özellikleridir. grid.json
Ben yükleme ediyorum ait
$.getJSON("http://example.com/posts/grid.json" + location.search, function (data) {
grid = map_canvas.data.addGeoJson(data);
map_canvas.data.setStyle(function(feature) {
return /** @type {google.maps.Data.StyleOptions} */({
strokeWeight: Math.log(feature.getProperty('posts_here')),
});
})
});
Örnek:
{
"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"
}
}
aracılığıyla özelliğine erişebilir. Kendi kendine ders: console.log() HER ŞEY. – schnauss