+ endpoint.clearValue = function () {
+ if (endpoint.geocodeRequest) endpoint.geocodeRequest.abort();
+ delete endpoint.geocodeRequest;
+ removeLatLng();
+ delete endpoint.value;
+ input.val("");
+ map.removeLayer(endpoint.marker);
+ };
+
+ endpoint.swapCachedReverseGeocodes = function (otherEndpoint) {
+ const g0 = endpoint.cachedReverseGeocode;
+ const g1 = otherEndpoint.cachedReverseGeocode;
+ delete endpoint.cachedReverseGeocode;
+ delete otherEndpoint.cachedReverseGeocode;
+ if (g0) otherEndpoint.cachedReverseGeocode = g0;
+ if (g1) endpoint.cachedReverseGeocode = g1;
+ };
+
+ function getGeocode() {
+ const viewbox = map.getBounds().toBBoxString(), // <sw lon>,<sw lat>,<ne lon>,<ne lat>
+ geocodeUrl = OSM.NOMINATIM_URL + "search?" + new URLSearchParams({ q: endpoint.value, format: "json", viewbox });