在地图上可视化以获得响应

时间:2019-09-11 14:23:28

标签: html dictionary openstreetmap

大家好,我有下面的简单代码来显示OSM映射:

<head>
<title>layer OSM </title>   
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript">

// Posizione iniziale della mappa
    var lat=45.47806;
    var lon=9.22824;
    var zoom=17;

    function init() {

        map = new OpenLayers.Map ("map", {
            controls:[ 
            new OpenLayers.Control.Navigation(),
                       new OpenLayers.Control.PanZoomBar(),
                       new OpenLayers.Control.ScaleLine(),
                       new OpenLayers.Control.Permalink('permalink'),
                       new OpenLayers.Control.MousePosition(),                    
                       new OpenLayers.Control.Attribution()
                      ],
            projection: new OpenLayers.Projection("EPSG:900913"),
            displayProjection: new OpenLayers.Projection("EPSG:4326")
            } );

        var mapnik = new OpenLayers.Layer.OSM("OpenStreetMap (Mapnik)");

        map.addLayer(mapnik);

        var lonLat = new OpenLayers.LonLat( lon ,lat )
          .transform(
            new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
            map.getProjectionObject() // to Spherical Mercator Projection
          );

        map.setCenter (lonLat, zoom);

 }

</script>
</head> 
<body onload="init();">
 <span style="font-family: Arial; font-weight: bold;">Esempio di mappa OSM</span>
<div style="width:100%; height:95%" id="map"></div>
</body>
</html>

我还有以下获取请求:

https://api.mapbox.com/matching/v5/mapbox/driving/-117.17282,32.71204;-117.17288,32.71225;-117.17293,32.71244?access_token=YOUR_TOKEN

如何在HTML文件中正确实现此get请求,以及如何在该地图上可视化响应?

0 个答案:

没有答案