2 //= require leaflet.osm
4 window.onload = function () {
5 var query = (window.location.search || '?').substr(1),
8 var pairs = query.split('&');
9 for (var i = 0; i < pairs.length; i++) {
10 var parts = pairs[i].split('=');
11 args[parts[0]] = decodeURIComponent(parts[1] || '');
14 var map = L.map("map");
15 map.attributionControl.setPrefix('');
17 if (!args.layer || args.layer === "mapnik" || args.layer === "osmarender") {
18 new L.OSM.Mapnik().addTo(map);
19 } else if (args.layer === "cyclemap" || args.layer === "cycle map") {
20 new L.OSM.CycleMap().addTo(map);
21 } else if (args.layer === "transportmap") {
22 new L.OSM.TransportMap().addTo(map);
23 } else if (args.layer === "mapquest") {
24 new L.OSM.MapQuestOpen().addTo(map);
25 } else if (args.layer === "hot") {
26 new L.OSM.HOT().addTo(map);
30 L.marker(args.marker.split(','), {icon: L.icon({
31 iconUrl: <%= asset_path('images/marker-icon.png').to_json %>,
32 iconSize: new L.Point(25, 41),
33 iconAnchor: new L.Point(12, 41),
34 shadowUrl: <%= asset_path('images/marker-shadow.png').to_json %>,
35 shadowSize: new L.Point(41, 41)
40 var bbox = args.bbox.split(',');
41 map.fitBounds([L.latLng(bbox[1], bbox[0]),
42 L.latLng(bbox[3], bbox[2])]);