0
如何從沒有事件監聽器的圖層(加載geoJSON)獲取「特徵」數據?如何從沒有事件監聽器的功能獲取屬性? (event.feature)
這就是通常的方式,其工作正常:
layer1.addListener('mouseover', function (event) {
console.log(event.feature.getProperty('description'));
}
,但現在我想從數據對象「層1」的值。
我想已經是這個:
layer1.getProperty('description')
layer1.feature.getProperty('description')
我如何加載GeoJSON的
var layer1 = new google.maps.Data();
layer1 = loadGeoJson('https://googledrive.com/host/MYFILE')
JSON的內容
這裏順便說一句簡短問題的方式:如果我有更多的特色res(例如多邊形)在我的JSON,我可以得到這個值來操縱(例如,切換可見度)嗎?
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
12.3456789,
01.2345678,
0
]
},
"properties": {
"name": "Test Polygon",
"description": "My Test Description"
}
}
]
}
謝謝你m8,工作正常。 – kaito