add geolocation for initial map

This commit is contained in:
Mark Campbell-Smith 2014-04-02 11:50:11 +11:00
parent 7e5b03076d
commit 95a61601f3
3 changed files with 5 additions and 4 deletions

View File

@ -33,7 +33,7 @@ function init() {
strokeWeight: 2 strokeWeight: 2
} }
mapOptions = { mapOptions = {
center: new google.maps.LatLng(52.23, 21.01), center: new google.maps.LatLng(geoip_latitude(),geoip_longitude()),
zoom: 8, zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeId: google.maps.MapTypeId.ROADMAP,
scaleControl: true scaleControl: true

View File

@ -74,8 +74,8 @@ function init() {
'http://3.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png']); 'http://3.tiles.ump.waw.pl/ump_tiles/${z}/${x}/${y}.png']);
map.addLayer(ump); map.addLayer(ump);
} }
var position = new OpenLayers.LonLat(21.01,52.23).transform(wgs84, mercator); var position = new OpenLayers.LonLat(geoip_longitude(),geoip_latitude()).transform(wgs84, mercator);
var zoom = 8; var zoom = 6;
map.setCenter(position, zoom); map.setCenter(position, zoom);
// init layers // init layers
layerTrack = new OpenLayers.Layer.Vector('Track'); layerTrack = new OpenLayers.Layer.Vector('Track');

View File

@ -72,7 +72,6 @@ $track_form .= '
<input id="latest" type="checkbox" onchange="toggleLatest();"> '.$lang_latest.'<br /> <input id="latest" type="checkbox" onchange="toggleLatest();"> '.$lang_latest.'<br />
</form> </form>
'; ';
// map api select form // map api select form
$api_form = ' $api_form = '
<u>'.$lang_api.'</u><br /> <u>'.$lang_api.'</u><br />
@ -140,6 +139,8 @@ print
var layer_ump = "'.$layer_ump.'"; var layer_ump = "'.$layer_ump.'";
</script> </script>
<script type="text/javascript" src="main.js"></script> <script type="text/javascript" src="main.js"></script>
<script language="javascript" src="http://j.maxmind.com/app/geoip.js"></script>
'; ';
if ($mapapi == "gmaps") { if ($mapapi == "gmaps") {
print print