NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

4
1

Hello,

I am looking for a way to search businesses within a circle (or a polygon) around a GPS coord. It will be nice if I am able to additionally filter results by passing in a parameter such as "coffee" or "school". I looked around, but could not find exactly what I wanted. I have looked at the wiki page for Nominatim, various other forums etc. Here are couple of searches i tried which gave me only one result. How do i increase the number of results I get back?

http://nominatim.openstreetmap.org/search?format=xml&q=41.760584,-88.320071 That returns only one place thats at that specific lat lon.

http://nominatim.openstreetmap.org/search?format=xml&viewbox=-88.85,42.25,-87.65,41.05&q=coffee&bounded=1&limit=100 That returns a few (<100) coffee shops in the bounding box, however, they are definitely not all.

Finally, if I want all places in the bounding box, (so if I omit the "q" param) I dont get any results at all.

So, how to really do this?

Best, Sachin Dole

This question is marked "community wiki".

asked 19 Jul '12, 20:26

sdole's gravatar image

sdole
1123
accept rate: 0%


Nominatim understands the near keyword to search for certain POI types around a coordinate. For example, you can ask for schools around a geo point like this:

http://nominatim.openstreetmap.org/search?q=school near [41.760584,-88.320071]

The types of POIs that Nominatim currently understands are listed on this page of special phrases.

Note however, this query will not necessarily get you all the schools in the area but only a selection. Nominatim is a search tool after all, not a tool for downloading data. If you need complete lists, the Overpass or XAPI are indeed better suited.

permanent link

answered 23 Jul '12, 22:57

lonvia's gravatar image

lonvia
6.2k25789
accept rate: 40%

Such a bad api. If I want to search for school in my language (Russian) I have to replace "near" to my language as well, школа возле [41.760584,-88.320071]. I can't do it programmatically for all languages and how I'm supposed to detect the language user types.

(06 Nov '18, 14:05) user5555

1) There is Overpass API which might be better suited for your use case. 2) Detecting the user language can be done by looking at the browser's language setting, i.e. at the Accept-Language header.

(06 Nov '18, 14:30) scai ♦

See the Overpass API or the XAPI.

permanent link

answered 19 Jul '12, 21:31

hfs's gravatar image

hfs
85151525
accept rate: 17%

Yes, it has such function, but how to search for random query input? What would be equal to "search?q=*" of Nominatim API. Overpass API has tags like "name", "amenity" and so on but they are useless 'cause API expect full match (100%) with query you input for searching, so it doesn't work like Nominatim API or Google Search

(06 Nov '18, 14:09) user5555

As written before:

If you want for example all schools around the coordinate 41.76 north 88.32 east, please use [http://overpass-api.de/api/interpreter?data=(way(bbox)[amenity=school];>;node(bbox)[amenity=school];);out;&bbox=-88.4,41.7,-88.3,41.8][1]

Similarly, you can get all cafes with [http://overpass-api.de/api/interpreter?data=(way(bbox)[amenity=cafe];>;node(bbox)[amenity=cafe];);out;&bbox=-88.4,41.7,-88.3,41.8][2] Apparently, there are none in the database. You also don't see any on the Mapnik map there.

The location is specified as bounding box. Thus, the radius is controlled by the difference between the two longitude or latitude values.

permanent link

answered 23 Jul '12, 08:57

Roland%20Olbricht's gravatar image

Roland Olbricht
6.7k36489
accept rate: 36%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

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:

×689
×193

question asked: 19 Jul '12, 20:26

question was seen: 17,489 times

last updated: 06 Nov '18, 14:30

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum