Created
August 10, 2023 13:58
-
-
Save DylanCodeCabin/b1343f0d0580d73d550dca7efc841053 to your computer and use it in GitHub Desktop.
Hotfix for OpenLayers Geocoding issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(($) => { | |
WPGMZA.OLGeocoder.prototype.getResponseFromNominatim = function(options, callback) { | |
var data = { | |
q: options.address, | |
format: "json" | |
}; | |
options.componentRestrictions && options.componentRestrictions.country ? data.countrycodes = options.componentRestrictions.country : options.country && (data.countrycodes = options.country), | |
$.ajax("https://nominatim.openstreetmap.org/search", { | |
data: data, | |
success: function(response, xhr, status) { | |
callback(response) | |
}, | |
error: function(response, xhr, status) { | |
callback(null, WPGMZA.Geocoder.FAIL) | |
} | |
}) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment