koordinaten via click herausfinden
This commit is contained in:
parent
52b6aa8804
commit
961e4b92ec
|
@ -58,6 +58,7 @@
|
||||||
<li><a href="nodes.html">Knotengraph</a></li>
|
<li><a href="nodes.html">Knotengraph</a></li>
|
||||||
<li><a href="geomap.html">Knotenkarte</a></li>
|
<li><a href="geomap.html">Knotenkarte</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<button id="gpsbutton">Koordinaten beim nächsten Klick anzeigen</button>
|
||||||
</header>
|
</header>
|
||||||
<div id="map"></div>
|
<div id="map"></div>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -48,6 +48,15 @@ arrayOSM = ["http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg",
|
||||||
click.activate();
|
click.activate();
|
||||||
|
|
||||||
load_json(vectorLayer, map)
|
load_json(vectorLayer, map)
|
||||||
|
|
||||||
|
d3.selectAll("#gpsbutton").on("click", function() {
|
||||||
|
function clickhandler(e) {
|
||||||
|
var lonlat = map.getLonLatFromViewPortPx(e.xy).transform(map.getProjectionObject(), new OpenLayers.Projection("EPSG:4326"))
|
||||||
|
alert(lonlat.lon + " " + lonlat.lat)
|
||||||
|
map.events.unregister("click", map, clickhandler)
|
||||||
|
}
|
||||||
|
var clickevent = map.events.register("click", map, clickhandler)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function resizeMap()
|
function resizeMap()
|
||||||
|
|
Loading…
Reference in a new issue