aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/static/js/geolocation-map.js
blob: 22cbe2f3db6d83f11e3eab0972e4b49d710c2b02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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);
});