-//= require qs/dist/qs
-
L.extend(L.LatLngBounds.prototype, {
getSize: function () {
return (this._northEast.lat - this._southWest.lat) *
},
getUrl: function (marker) {
- var precision = OSM.zoomPrecision(this.getZoom()),
- params = {};
+ const params = {};
if (marker && this.hasLayer(marker)) {
- var latLng = marker.getLatLng().wrap();
- params.mlat = latLng.lat.toFixed(precision);
- params.mlon = latLng.lng.toFixed(precision);
+ [params.mlat, params.mlon] = OSM.cropLocation(marker.getLatLng(), this.getZoom());
}
var url = window.location.protocol + "//" + OSM.SERVER_URL + "/",
- query = Qs.stringify(params),
+ query = new URLSearchParams(params),
hash = OSM.formatHash(this);
if (query) url += "?" + query;
return (interlaced_x << 1) | interlaced_y;
}
- var params = {};
+ const params = new URLSearchParams();
var layers = this.getLayersCode().replace("M", "");
if (layers) {
- params.layers = layers;
+ params.set("layers", layers);
}
if (marker && this.hasLayer(marker)) {
- params.m = "";
+ params.set("m", "");
}
if (this._object) {
- params[this._object.type] = this._object.id;
+ params.set(this._object.type, this._object.id);
}
- var query = Qs.stringify(params);
+ const query = params.toString();
if (query) {
str += "?" + query;
}
},
getGeoUri: function (marker) {
- var precision = OSM.zoomPrecision(this.getZoom()),
- latLng,
- params = {};
+ let latLng = this.getCenter();
+ const zoom = this.getZoom();
if (marker && this.hasLayer(marker)) {
- latLng = marker.getLatLng().wrap();
- } else {
- latLng = this.getCenter();
+ latLng = marker.getLatLng();
}
- params.lat = latLng.lat.toFixed(precision);
- params.lon = latLng.lng.toFixed(precision);
- params.zoom = this.getZoom();
-
- return "geo:" + params.lat + "," + params.lon + "?z=" + params.zoom;
+ return `geo:${OSM.cropLocation(latLng, zoom).join(",")}?z=${zoom}`;
},
addObject: function (object, callback) {