From 95a61601f3c8d15bdaa8bbd7cbb7eee50595da2e Mon Sep 17 00:00:00 2001 From: Mark Campbell-Smith Date: Wed, 2 Apr 2014 11:50:11 +1100 Subject: add geolocation for initial map --- api_gmaps.js | 2 +- api_openlayers.js | 4 ++-- index.php | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/api_gmaps.js b/api_gmaps.js index 26a787c..2ca65f7 100755 --- a/api_gmaps.js +++ b/api_gmaps.js @@ -33,7 +33,7 @@ function init() { strokeWeight: 2 } mapOptions = { - center: new google.maps.LatLng(52.23, 21.01), + center: new google.maps.LatLng(geoip_latitude(),geoip_longitude()), zoom: 8, mapTypeId: google.maps.MapTypeId.ROADMAP, scaleControl: true diff --git a/api_openlayers.js b/api_openlayers.js index 87f0abf..7795a5b 100755 --- a/api_openlayers.js +++ b/api_openlayers.js @@ -74,8 +74,8 @@ function init() { 'http://3.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png']); map.addLayer(ump); } - var position = new OpenLayers.LonLat(21.01,52.23).transform(wgs84, mercator); - var zoom = 8; + var position = new OpenLayers.LonLat(geoip_longitude(),geoip_latitude()).transform(wgs84, mercator); + var zoom = 6; map.setCenter(position, zoom); // init layers layerTrack = new OpenLayers.Layer.Vector('Track'); diff --git a/index.php b/index.php index a5d4136..f64a792 100755 --- a/index.php +++ b/index.php @@ -72,7 +72,6 @@ $track_form .= ' '.$lang_latest.'
'; - // map api select form $api_form = ' '.$lang_api.'
@@ -140,6 +139,8 @@ print var layer_ump = "'.$layer_ump.'"; + + '; if ($mapapi == "gmaps") { print -- cgit v1.2.3