我可以使用Google Maps API v3操作KML吗?
我正在Google Maps API v3中使用KMLLayer加载KML.是否可以参考地图上的多边形并进行诸如更改颜色或透明度之类的事情?
I'm loading a KML using KMLLayer in Google Maps API v3. Is it possible to reference the polygons on the map and do things like change color or transparency?
不,您不能那样做,因为kmllayer中没有像对象这样的多边形.从 Google文档 :
No you can't do it like that since there are no polygons like objects in a kmllayer. From the google docs:
Maps API将提供的地理XML数据转换为KML 使用V3瓷砖叠加层显示在地图上的表示形式. 这个KML看起来(并且在某种程度上表现得很像)熟悉的V3叠加层 元素. KML和GeoRSS点元素呈现为 标记,例如,元素渲染为折线 和元素呈现为多边形.相似地, 元素在 地图.但是重要的是,这些对象不是 Google Maps API 标记,折线,多边形或GroundOverlay;相反,他们是 呈现在地图上的单个对象中.
The Maps API converts the provided geographic XML data into a KML representation which is displayed on the map using a V3 tile overlay. This KML looks (and somewhat behaves) like familiar V3 overlay elements. KML and GeoRSS point elements are rendered as markers, for example, elements are rendered as polylines and elements are rendered as polygons. Similarly, elements are rendered as rectangular images on the map. Importantly, however, these objects are not Google Maps API Markers, Polylines, Polygons or GroundOverlays; instead, they are rendered into a single object on the map.
This page might be helpfull in exploring alternatives