开发者

Overlaying Multiple KML files on google Map displayed in the browser

Need to know the procedure for overlaying multiple KML files on a single Google Map that 开发者_Python百科is displayed in the browser. The KML files intended for this can point to different locations. Ex:KML1 for North America & KML2 for Asia. Could anyone help me out in this.


I think you are looking for this:

http://code.google.com/apis/kml/documentation/kml_tut.html#network_links

example:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Folder>
    <name>Network Links</name>
    <visibility>0</visibility>
    <open>0</open>
    <description>Network link example 1</description>
    <NetworkLink>
      <name>Random Placemark</name>
      <visibility>0</visibility>
      <open>0</open>
      <description>A simple server-side script that generates a new random
        placemark on each call</description>
      <refreshVisibility>0</refreshVisibility>
      <flyToView>0</flyToView>
      <Link>
        <href>http://yourserver.com/map1.kml</href>
      </Link>
    </NetworkLink>

    <NetworkLink>
      <name>Random Placemark</name>
      <visibility>0</visibility>
      <open>0</open>
      <description>A simple server-side script that generates a new random
        placemark on each call</description>
      <refreshVisibility>0</refreshVisibility>
      <flyToView>0</flyToView>
      <Link>
        <href>http://yourserver.com/map2.kml</href>
      </Link>
    </NetworkLink>
  </Folder>
</kml>


You can do it with Google Maps JS API. You need to create overlays with google.maps.KmlLayer for each KML files.

See this example: http://code.google.com/apis/maps/documentation/javascript/examples/layer-kml.html

API Documentation: http://code.google.com/apis/maps/documentation/javascript/overlays.html#KMLLayers

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜