var params = OSM.params();
if (params.lat && params.lon) {
- $('.edit-located').show();
-
- $.ajax({
- url: "http://nominatim.openstreetmap.org/reverse",
- data: {
- lat: params.lat,
- lon: params.lon,
- zoom: 10
- },
- success: function(xml) {
- var result = $(xml).find('result');
- if (result.length) {
- $('.edit-located').hide();
- $('.edit-geocoded').show();
- $('.edit-geocoded-location').text(result.text());
- }
- }
- });
+ params.lat = parseFloat(params.lat);
+ params.lon = parseFloat(params.lon);
+ params.zoom = params.zoom || 17;
- params = {
- lat: params.lat,
- lon: params.lon,
- zoom: params.zoom || 17,
- editor: params.editor
- };
+ var url = '/edit';
- $('.start-mapping').attr('href', '/edit?' + $.param(params));
+ if (params.editor) {
+ url += '?editor=' + params.editor;
+ }
- } else if (navigator.geolocation) {
- $('.edit-geolocated').show();
+ url += OSM.formatHash(params);
+ $('.start-mapping').attr('href', url);
+
+ } else if (navigator.geolocation) {
function geoSuccess(position) {
- window.location = '/edit?zoom=17&lat=' + position.coords.latitude + '&lon=' + position.coords.longitude;
+ window.location = '/edit' + OSM.formatHash({
+ zoom: 17,
+ lat: position.coords.latitude,
+ lon: position.coords.longitude
+ });
}
function geoError() {