में एक भौगोलिक डेटा परत के गुण प्राप्त करना डेटा परत के रूप में Google मानचित्र में एक geoJSON फ़ाइल लोड करते समय, डेटा परत के गुणों को कैसे एक्सेस किया जाता है?Google मानचित्र V3
मुझे पता है कि access the individual properties, उदाहरण के लिए posts_here
जैसे उदाहरण में। जो मैं ढूंढ रहा हूं वह परत के लिए गुण है- इस उदाहरण में, maxPosts
। grid.json
मैं लोड हो रहा हूँ की
$.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')),
});
})
});
उदाहरण:
{
"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"
}
}
आप इसे मिल गया है संपत्ति का उपयोग कर सकते हैं। स्वयं को सबक: console.log() सबकुछ। – schnauss