We need the search field on the ‘map’ tab of the item’s edit page, but the field NEVER finds anything, except if we type a lat/long directly, which isn"t’ very useful.
The error message is (Error: "Whatever location information " was not found. Even searching for something as simple as New York or Paris doesn’t work, so I’m pretty sure it is an issue with the way geocoding is implemented.
I checked and actually no ajax call seems to be made when clicking the submit button. No network activity at all.
I tried to substitute the geocoder which is used by modifying the source, but nominatim doesn’t work better than the default photon.
Omeka 2.6.1, Geolocation 3.0.1, no Neatline.
I’d be very grateful if anybody could point me to a solution to this.
Nominatim and Photon both use the same data, pretty much… The OSM geocoders are definitely worse or at least harder to use than Google’s. The issue is that there really aren’t all that many free-to-use geocoders out there that don’t come with fairly significant restrictions (many require you to only use their flavor of map, or forbid you from saving the obtained coordinates).
I don’t have any problems with the simple queries you’ve specifically mentioned (“New York” and “Paris”). If you’re not seeing an AJAX request at all, then there’s something wrong going on: one should occur right when you submit the search form. Are there any JavaScript errors in the console?
No javascript errors, no. Tried a local installation and there still is no Ajax call emitted. Also tried to disable my custom modules, still the same error.
EDIT : Tried the same install with Chrome (as opposed to Firefox) and the search DOES work. I highly suspect an adblocker somewhere.
jQuery('#geolocation_find_location_by_address').on('click', function (event) {
event.preventDefault();
var address = jQuery('#geolocation_address').val();
console.log('geocoder called');
geocoder.geocode(address).then(function (coords) {
console.log('geocoder succeeded');
var marker = omekaGeolocationForm.setMarker(L.latLng(coords));
if (marker === false) {
jQuery('#geolocation_address').val('');
jQuery('#geolocation_address').focus();
}
}, function () {
console.log('geocoder failed');
alert('Error: "' + address + '" was not found!');
});
});
The code above always displays in console the two strings ‘called’ and ‘failed’, but never ‘succeeded’.
So it seems like the instanciation of the object itself fails and only the fail function of ‘Then’ is called. The code doesn’t even go to the point where the actual geocoding is made.
OK, I found it : another plugin (Iten Relations) which we have customized makes everything work when deactivated. It uses an AJAX entry point so I think there is a clash somewhere between the ajax calls.
Thanks for your patience. I’ll update this thread when I’ll find what’s wrong exactly.
The other place the geocoder is used is on the items advanced search page, to allow you to specify a location to search for mapped points within some given radius.
It had nothing to do with the module : I had some Jquery code which set up ajax in a certain way in another script. I deleted the code responsible and everything went smoothly from here.