大家好,我有下面的简单代码来显示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>
我还有以下获取请求:
如何在HTML文件中正确实现此get请求,以及如何在该地图上可视化响应?