Commit | Line | Data |
---|---|---|
9542a2ba JW |
1 | /** |
2 | * GNU MediaGoblin -- federated, autonomous media hosting | |
cf29e8a8 | 3 | * Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. |
9542a2ba JW |
4 | * |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU Affero General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU Affero General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Affero General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
836df45d | 19 | $(document).ready(function () { |
deea3f66 JW |
20 | if (!$('#tile-map').length) { |
21 | return; | |
22 | } | |
23 | console.log('Initializing map'); | |
24 | ||
836df45d JW |
25 | var longitude = Number( |
26 | $('#tile-map #gps-longitude').val()); | |
27 | var latitude = Number( | |
28 | $('#tile-map #gps-latitude').val()); | |
29 | ||
9542a2ba | 30 | // Get a new map instance attached and element with id="tile-map" |
836df45d JW |
31 | var map = new L.Map('tile-map'); |
32 | ||
441fee1a | 33 | var mqtileUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; |
fd79d33a | 34 | var mqtileAttrib = '<a id="osm_license_link">see map license</a>'; |
836df45d JW |
35 | var mqtile = new L.TileLayer( |
36 | mqtileUrl, | |
441fee1a | 37 | {maxZoom: 18}); |
836df45d | 38 | |
fd79d33a SS |
39 | map.attributionControl.setPrefix(''); |
40 | var location = new L.LatLng(latitude, longitude); | |
836df45d JW |
41 | map.setView(location, 13).addLayer(mqtile); |
42 | ||
43 | var marker = new L.Marker(location); | |
44 | map.addLayer(marker); | |
45 | }); |