Several bugs prevent OSM Nominatim from working:
- Bad API URL
- Address parameter not sanitized correctly
- Request URL not cleanly built
- (Unused parameter osm_type)
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | fix_osm_nominatim_cumulates_2682613_2682527-3050679-14.patch | 3.49 KB | denix |
| #6 | fix_osm_nominatim_cumulates_2682613_2682527-3050679-6.patch | 1.57 KB | anrikun |
| #2 | fix_osm_nominatim-3050679-2.patch | 1.03 KB | anrikun |
Comments
Comment #2
anrikun commentedPatch provided here
Comment #3
anrikun commentedThis 2nd version cumulates other important patches from:
#2682527: OSM Nominatim Request - User Agent always drupal.org
#2682613: OSM Nominatim - Add one Second forced delay
EDIT : this patch has an error, use next patch below.
Comment #4
anrikun commentedPrevious patch had a error. Uploaded correct version here.
Comment #5
anrikun commentedComment #6
anrikun commentedCumulative patch rerolled for latest dev.
Comment #7
ugintl commentedDont know what it is for, but thanks. I have applied the patch.
Comment #8
ugintl commentedI am using osm nominatim. Does it have an api or I can just use it without api?
Comment #9
anrikun commented@ugintl
You don't have to use any API.
Comment #10
robcarrI've just applied the patch against latest DEV release and I'm still getting 'No results for geocoding' when OSM is selected. Same nodes work fine when Google Geocoding API is used.
Comment #11
denix commented@robcarr check your query against https://nominatim.openstreetmap.org
Comment #12
robcarr@denix Tested various addresses directly at https://nominatim.openstreetmap.org as suggested: they work fine. But when used from Drupal I still get 'No results for geocoding'... whereas Google geocodes fine
?
Comment #13
drummWe ran into this issue when we were starting to use this on www.drupal.org.
#6 works well, although this won’t do what it is trying to do:
That just slows down the current request. If another request is made, it will be in another process, unless you are doing bulk geocoding. There should be a way to use locking to not slow down people, and enforce the limit across all processes.
Comment #14
denix commentedThanks @anrikun for putting all this together. Following @drumm comment, I came up with this version that include a few lines of documentation, a delay system to limit execution to 1sec for batch executions, the use of a valid email according to policy of use and few extra messages so we now know what's happening with our calls. I do really hope that the developers will release a new stable soon!
Comment #15
denix commentedHi @drumm, I was looking at using lock_acquire to grant lock to the function, but I am not sure that it is the right solution.
I did some tests, but I could not see any real difference.
Do you have any experience with it? or a sleep is enough?
There is also the risk of lock for a very long time if you hit a timeout for example.
Comment #16
drummThis looks like a good start, and an improvement over what was there. The delay won’t happen until a second request after the first.
The delay is still hard-coded to 1s, so if code is doing something like bulk geocoding, that could be excessive. For example:
Static variables are only static within one PHP process - so if two requests come in simultaneously, or bulk processing is happening in parallel, the 1s delay won't be enforced.
Using
lock_acquire()will prevent simultaneous requests, and I think is likely to be part of the solution here. I don’t see functionality in the locking system to wait 1s after the last lock has been released.I expect the time of the last geocoding will have to be stored somewhere, like
variable_set(…, microtime())/variable_get(). Frequently-changing variables aren’t great for the variables cache, but this is probably fine for the average site that just geocodes an address or two when content is changed.The cache system could be abused, setting a 1s expiration. Cache clears are rare enough, risking losing the delay if the cache clears is probably fine. But the cache expiration time only has a 1s resolution, so it might not be ideal.
Otherwise, I’m not aware of an ideal system in Drupal to enforce with without drawbacks. I recommend just picking one, and maybe filing a followup issue for a perfect solution. The drawbacks are only if your site is doing enough geocoding to potentially bump into the rate limit, if someone has that use case, they can pick up the followup issue.
Comment #17
denix commented@drumm I think that the issue of lock should be set at the level of geocoder, and not left to the single plugins, what do you think? If you agree then we can set this issue as "reviewed & tested" and move the discussion about the lock to a separated issue.