开发者

KML overlay as string

开发者 https://www.devze.com 2023-03-28 01:12 出处:网络
Is there any way to create a KML overlay in Google Maps by passing the KML as a string rather than as a publicly accessible URL? AFAICT there is no开发者_Python百科 such option in the Google Maps API

Is there any way to create a KML overlay in Google Maps by passing the KML as a string rather than as a publicly accessible URL? AFAICT there is no开发者_Python百科 such option in the Google Maps API v3. I am not asking about the API but about possible end runs around this limitation.

Personally I can think of only one: to parse the KML and generate equivalent JS. Does anyone have a better suggestion?


geoxml3 has a parseKmlString method, which will parse a string of kml and can create native google maps API v3 objects from it. I have used it to parse kml fragments out of FusionTables.


I've tried too but i haven't found a way to do this.

The reason is explained here: https://stackoverflow.com/a/6152916/2131283

For the tests my work around was sharing the kml file on my dropbox then give the direct access url with the token to the constructor

kmlLayer = new google.maps.KmlLayer
    url: 'https://dl.dropboxusercontent.com/s/eg/gmaps.kmltoken_hash=HASH_CODE&dl=1'


Looking over the API it doesn't appear that this is possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号