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);
28 L.marker(args.marker.split(','), {icon: L.icon({
29 iconUrl: <%= asset_path('images/marker-icon.png').to_json %>,
30 iconSize: new L.Point(25, 41),
31 iconAnchor: new L.Point(12, 41),
32 shadowUrl: <%= asset_path('images/marker-shadow.png').to_json %>,
33 shadowSize: new L.Point(41, 41)
38 var bbox = args.bbox.split(',');
39 map.fitBounds([L.latLng(bbox[1], bbox[0]),
40 L.latLng(bbox[3], bbox[2])])