From 961e4b92ec3a36e43fb8a0c3c048a745457107f0 Mon Sep 17 00:00:00 2001 From: Nils Schneider Date: Thu, 6 Sep 2012 20:13:09 +0200 Subject: [PATCH] koordinaten via click herausfinden --- html/geomap.html | 1 + html/geomap.js | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/html/geomap.html b/html/geomap.html index ddd1c2c..42fcc75 100644 --- a/html/geomap.html +++ b/html/geomap.html @@ -58,6 +58,7 @@
  • Knotengraph
  • Knotenkarte
  • +
    diff --git a/html/geomap.js b/html/geomap.js index 888c175..db9abcd 100644 --- a/html/geomap.js +++ b/html/geomap.js @@ -48,6 +48,15 @@ arrayOSM = ["http://otile1.mqcdn.com/tiles/1.0.0/osm/${z}/${x}/${y}.jpg", click.activate(); 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()