2 L.extend(L.LatLngBounds.prototype, {
4 return (this._northEast.lat - this._southWest.lat) *
5 (this._northEast.lng - this._southWest.lng);
9 return new L.LatLngBounds(this._southWest.wrap(), this._northEast.wrap());
13 L.Icon.Default.imagePath = <%= "#{asset_prefix}/images".to_json %>;
18 function getUserIcon(url) {
20 iconUrl: url || <%= asset_path('marker-red.png').to_json %>,
23 popupAnchor: [1, -34],
24 shadowUrl: <%= asset_path('images/marker-shadow.png').to_json %>,
29 function addObjectToMap(object, map, options) {
30 if (objectLoader) objectLoader.abort();
31 if (objectLayer) map.removeLayer(objectLayer);
33 objectLoader = $.ajax({
34 url: OSM.apiUrl(object),
36 success: function (xml) {
37 objectLayer = new L.OSM.DataLayer(null, {
45 objectLayer.interestingNode = function (node, ways, relations) {
46 if (object.type === "node") {
48 } else if (object.type === "relation") {
49 for (var i = 0; i < relations.length; i++)
50 if (relations[i].members.indexOf(node) != -1)
57 objectLayer.addData(xml);
59 if (options.zoom) map.fitBounds(objectLayer.getBounds());
60 if (options.callback) options.callback(objectLayer.getBounds());
62 objectLayer.addTo(map);