2

I have a local Nominatim instance in which I carry out searches within a bounding box. The problem is that for whatever value of limit, I get a maximum of 50 results. I understand that this is the limit set by Nominatim so that the public server does not get overloaded.

Consider this reproductible example (sent to the Nominatim public server). Only the server would be different on the local instance.

http://nominatim.openstreetmap.org/search?q=[pub]&format=xml&bounded=1&limit=50&viewbox=4.7718134,45.7073666,4.8983774,45.8082628

As I am running my own instance, I am wondering, is there a way to raise the maximum number of results of my local Nominatim instance?

A possible solution would be to send queries iteratively, with the exclude_place_id argument. For instance, the second query would exclude the place_id of the first query and give a list of 50 other pubs, an so on until no further match is found. But this is not very eleguant...

1
  • Did you ever find a solution for this? Commented Jan 12, 2022 at 21:33

1 Answer 1

1

Looking at the source code linked in this related post, it seems this upper limit is hardcoded in Geocode.php:

function setLimit($iLimit = 10)
    {
        if ($iLimit > 50) $iLimit = 50;
        if ($iLimit < 1) $iLimit = 1;
        $this->iFinalLimit = $iLimit;
        $this->iLimit = $this->iFinalLimit + min($this->iFinalLimit, 10);
    }

I was able to just change both hardcoded 50s in /usr/local/lib/nominatim/lib-php/Geocode.php Line to 1000 and it worked (returned ~160 results in my case, which is a reasonable for my search).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.