我能得到伦敦地区的确切坐标并在代码中使用它们吗? [英] Can I get exact coordinates of London zones and use them in code?

查看:85
本文介绍了我能得到伦敦地区的确切坐标并在代码中使用它们吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google Maps API。我发现已经绘制了伦敦运输形状和伦敦自治区形状。是否有可能获得确切的坐标如何完成,甚至使用API​​重新创建这些形状?



伦敦交通地图 -

  • 点击下载KML

  • 解压缩在文件中并获取链接(它是一个包含KML文件的文件,名为doc.kml):



    代码段:
    $ b

    function initialize() {var map = new google.maps.Map(document.getElementById(map_canvas)); layer = new google.maps.KmlLayer({map:map,url:http://www.google.com/maps/d/u/0/kml?mid=1eIjWEQyO-PchgJUttxBBkYqvPxE})} google.maps。 event.addDomListener(window,load,initialize);

    html,body,#map_canvas {height:100%;宽度:100%; margin:0px; < script src =https://



  • 至于伊斯灵顿自治市地图,那是一个真正的谷歌地图,你无法从谷歌,你需要找到另一个来源。


    I'm working with Google Maps API. I found that there are already drawn London transport shapes and London borough shapes. Is it possible to get exact coordinates how it's done and even recreate these shapes using API?

    London Transport Map - https://www.google.com/maps/d/u/0/viewer?mid=1eIjWEQyO-PchgJUttxBBkYqvPxE&ll=51.49280340511744%2C-0.17372399999999288&z=11

    Borough https://www.google.co.uk/maps/place/London+Borough+of+Islington

    解决方案

    The London Transportation Map is a "Google MyMap", those if public can have their data exported as KML/KMZ and shown on a Google Maps Javascript API v3 KmlLayer

    1. Go to the map
    2. click on the three vertical dots
    3. click on "Download KML"
    4. Select "Keep data up to date with network link (only useable online)."
    5. unzip that file and get the link out of it (it is a zip file containing a KML file called doc.kml): http://www.google.com/maps/d/u/0/kml?mid=1eIjWEQyO-PchgJUttxBBkYqvPxE
    6. use that as the URL for a KML layer (proof of concept fiddle)

    code snippet:

    function initialize() {
      var map = new google.maps.Map(document.getElementById("map_canvas"));
      layer = new google.maps.KmlLayer({
        map: map,
        url: "http://www.google.com/maps/d/u/0/kml?mid=1eIjWEQyO-PchgJUttxBBkYqvPxE"
      })
    
    }
    google.maps.event.addDomListener(window, "load", initialize);

    html,
    body,
    #map_canvas {
      height: 100%;
      width: 100%;
      margin: 0px;
      padding: 0px
    }

    <script src="https://maps.googleapis.com/maps/api/js"></script>
    <div id="map_canvas"></div>

    As for the Borough of Islington map, that is a "real" Google Map", you can't get that data from Google, you need to find another source.

    这篇关于我能得到伦敦地区的确切坐标并在代码中使用它们吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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