在Google Maps API v3中动态更改KML多边形的颜色 [英] Dynamically change colour of KML polygon in Google Maps API v3

查看:300
本文介绍了在Google Maps API v3中动态更改KML多边形的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Maps v3 API加载KML图层,并希望能够将KML的颜色从其默认蓝色更改为无需编辑KML文件本身。这是可能的使用JavaScript或其他手段?

I'm using Google Maps v3 API to load a KML layer and want to be able to change the colour of the KML from its default blue without having to edit the KML file itself. Is this possible using JavaScript or some other means?

谢谢,
尼尔

推荐答案

根据我对文档的理解,'不',但不是特别清楚。我试图做类似的事情(但更新mouseover / mouseout的颜色)。

From my understanding of the documentation, 'no', but it's not especially clear. I'm trying to do a similar thing (but update the colour of mouseover/mouseout).

KML文件由Google服务器加载,解析并发送到你的javascript对象被应用到地图上,所以,当你的javascript KMLLayer看到它时,它就全部被整理出来。

The KML file is loaded by the Google servers, parsed and sent along to your javascript object to be applied to the map, so, by the time your javascript KMLLayer sees it, it's all sorted out.

你也许可以用Styles做些什么和styleUrl。这应该可以让你设置一些不同的风格,然后在运行时应用,但是,我没有得到它的工作。

You may be able to do something with Styles and styleUrl. This is supposed to allow you to set a number of different styles that can then be applied at runtime, however, I haven't got it working.

这篇关于在Google Maps API v3中动态更改KML多边形的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆