diff options
author | Joar Wandborg <git@wandborg.com> | 2012-01-10 02:53:46 +0100 |
---|---|---|
committer | Joar Wandborg <git@wandborg.com> | 2012-01-25 23:42:04 +0100 |
commit | 836df45dbecbaa5c8156dbbdb93c1c23bee44be4 (patch) | |
tree | 63d4b691b8d36bff3145825e9d454a320068bfcf /mediagoblin/static/js | |
parent | 9bf7563d4c4c263fb6e5345bd1185aebb1c6ef8f (diff) | |
download | mediagoblin-836df45dbecbaa5c8156dbbdb93c1c23bee44be4.tar.lz mediagoblin-836df45dbecbaa5c8156dbbdb93c1c23bee44be4.tar.xz mediagoblin-836df45dbecbaa5c8156dbbdb93c1c23bee44be4.zip |
Added code for leaflet geolocation map
Diffstat (limited to 'mediagoblin/static/js')
l--------- | mediagoblin/static/js/extlib/leaflet | 1 | ||||
-rw-r--r-- | mediagoblin/static/js/geolocation-map.js | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/mediagoblin/static/js/extlib/leaflet b/mediagoblin/static/js/extlib/leaflet new file mode 120000 index 00000000..2fc302d7 --- /dev/null +++ b/mediagoblin/static/js/extlib/leaflet @@ -0,0 +1 @@ +../../../../extlib/leaflet/dist/
\ No newline at end of file diff --git a/mediagoblin/static/js/geolocation-map.js b/mediagoblin/static/js/geolocation-map.js new file mode 100644 index 00000000..22cbe2f3 --- /dev/null +++ b/mediagoblin/static/js/geolocation-map.js @@ -0,0 +1,29 @@ +$(document).ready(function () { + var longitude = Number( + $('#tile-map #gps-longitude').val()); + var latitude = Number( + $('#tile-map #gps-latitude').val()); + + console.log(longitude, latitude); + + var map = new L.Map('tile-map'); + + var mqtileUrl = 'http://otile{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.jpg'; + var mqtileAttrib = 'Map data © ' + + String(new Date().getFullYear()) + + ' OpenStreetMap contributors, CC-BY-SA.' + + ' Imaging © ' + + String(new Date().getFullYear()) + + ' <a target="_blank" href="http://mapquest.com">MapQuest</a>.'; + var mqtile = new L.TileLayer( + mqtileUrl, + {maxZoom: 18, + attribution: mqtileAttrib, + subdomains: '1234'}); + + var location = new L.LatLng(latitude, longitude); // geographical point (longitude and latitude) + map.setView(location, 13).addLayer(mqtile); + + var marker = new L.Marker(location); + map.addLayer(marker); +}); |