0

I've constructed the following query, I want to get "hospitals" which is a special phrase according to this link

https://wiki.openstreetmap.org/wiki/Nominatim/Special_Phrases/EN

This is my query

https://nominatim.openstreetmap.org/search?q=hospitals&format=jsonv2&polygon=50&addressdetails=1&lat=40.406932&lon=-79.932963

those GPS coordinates are from Pittsburgh, PA. But the results contains results from Nicaragua and Libya and they are not hospitals. Where have I made a mistake?

asked 29 Jul '18, 16:40

Dave4784's gravatar image

Dave4784
16334
accept rate: 0%

edited 29 Jul '18, 21:38

aseerel4c26's gravatar image

aseerel4c26 ♦
32.2k16239552


2 Answers:
1

A special phrase just means that nominatim will give some preference to items tagged amenity=hospital, it's still doing name matching on "Hospitals", so it's returning things with exactly that name.

Here's an example Overpass-API query that returns hospitals within a 10 Km radius of that location. Note that you can use that query outside of Overpass Turbo, it's just a convenient way to share it.

You could also compute a bounding box from the coordinate and restrict the search to that area, if that were more suitable for your goal.

permanent link

answered 29 Jul '18, 17:25

maxerickson's gravatar image

maxerickson
11.4k1075161
accept rate: 30%

edited 29 Jul '18, 17:25

Hello. Is something like that available for Nominatim API?

(05 Nov '18, 10:17) user5555

Not beyond what is mentioned in the other answer.

(05 Nov '18, 10:46) maxerickson

There isn't.

(05 Nov '18, 10:47) mtmail

Ok, thanks. Now I want to try Overpass-API. How to send just query using REST API (POST some json url)? And where to get results? Because your example draws on the map, but I want result in text format (json)

(06 Nov '18, 11:48) user5555

Never mind. Found out https://www.overpass-api.de/api/interpreter?data=THE SAME QUERY AS IN YOUR EXAMPLE, BUT EVERYTHING IN ONE LINE

(06 Nov '18, 12:04) user5555

And one more question - how to search for any building/place using any name? So it can be anything, not necessarily hospital. I tried replace "amenity" with "name", but it does't work like with Nominatim API, it excepts name which will match 100%, but I want just normal name query (like we search in Google and in Nominatim API)

(06 Nov '18, 13:55) user5555

Don't add questions to answers. Instead create a new question.

(06 Nov '18, 14:31) scai ♦
showing 5 of 7 show 2 more comments
1

The /search endpoint doesn't understand &lat or &lon parameters (only /reverse does), setting &polygon= to 50 has the same effect as 1 and only affects the output. See https://wiki.openstreetmap.org/wiki/Nominatim#Search

The closest you can get with Nominatim is using a query 'hospitals near 40.406932,-79.932963'. The 'near' (or 'in') is optional. You can set the &limit=50 to get more results (maximum is 100).

The Overpass-API system is more flexible (support more types of point-of-interest, more filters, better control over the search radius) overall.

permanent link

answered 29 Jul '18, 21:45

mtmail's gravatar image

mtmail
3.8k1059
accept rate: 30%

I like using the "hospital near 40.406932,-79.932963" method, but at some places it returns nothing. Is there a way to increase the sq miles it checks?

(01 Aug '18, 21:26) Dave4784

Nominatim doesn't have a parameter for that.

(06 Aug '18, 11:13) mtmail

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×591
×212
×163
×126
×122

question asked: 29 Jul '18, 16:40

question was seen: 1,679 times

last updated: 06 Nov '18, 14:31

powered by OSQA