Add a Geo URI link to the share panel

Fixes #799
This commit is contained in:
Eric Theise 2015-06-25 17:55:41 +01:00 committed by Tom Hughes
parent 4676179879
commit 6403cb9b08
4 changed files with 41 additions and 1 deletions

View file

@ -170,6 +170,24 @@ L.OSM.Map = L.Map.extend({
return str;
},
getGeoUri: function(marker) {
var precision = OSM.zoomPrecision(this.getZoom()),
latLng,
params = {};
if (marker && this.hasLayer(marker)) {
latLng = marker.getLatLng().wrap();
} else {
latLng = this.getCenter();
}
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;
},
addObject: function(object, callback) {
var objectStyle = {
color: "#FF6200",