Geolocation doesn't find anything


#1

Hi all and thanks for your work.

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.


#2

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?


#3

Thanks for your answer.

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.


#4

Apparently, Chrome is the only browser where the geolocation functions. Neither Safari nor IE work.

Maybe some strange JQuery bug ?


#5

Still digging on this issue.

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.


#6

I don’t have any issues with it in Firefox (with both tracking protection and ad-blocking enabled).


#7

But we tested on several machines and several installations and they all refuse to work outside Chrome.

Do you think trying to upgrade JQuery would be a good idea ?


#8

Sorry to insist but I can’t believe we’re the only ones experiencing this.

We have an Omeka instance with 2.4 and Geolocation 3.0 and it works with all browsers.

Our 2.5 instances show the same behaviour as 2.6.1 : only works with Chrome .

So, something happened between 2.4 and 2.5, and continues with 2.6.

Any idea on the matter would be invaluable.


#9

Does the geocoder fail in the same way when using it on item edit pages?

I don’t know about anybody else, but all I can say is I can’t reproduce your issue with Geolocation 3.0 + Omeka 2.6 + Firefox.


#10

I thought it was clear I was talking about the item edit screen, sorry.
Isn’t it the only place where one can use this field ?


#11

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.


#12

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.