Skip to content

Instantly share code, notes, and snippets.

@DylanCodeCabin
Created August 10, 2023 13:58
Show Gist options
  • Save DylanCodeCabin/b1343f0d0580d73d550dca7efc841053 to your computer and use it in GitHub Desktop.
Save DylanCodeCabin/b1343f0d0580d73d550dca7efc841053 to your computer and use it in GitHub Desktop.
Hotfix for OpenLayers Geocoding issue
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