This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Is there any way to get list data location from OSM around a location by POI types (e.g: restaurants , banks , …) as geoJson?

2

Hi everyone

I am a beginer with OSM dev I am currently working with different technologies for searching and showing OSM data in by search POI types . Like Google map , we have : https://maps.googleapis.com/maps/api/place/nearbysearch/json?

and then put parameter to this URL so we can get a JSON Array with location data in types and nearby a location

Does anyone know if there exists something ? and any one have idead to help me Sorry about my English . I am not good at english. Thank you very much.

asked 21 May '13, 03:58

TuanDM's gravatar image

TuanDM
41113
accept rate: 0%


One Answer:

8

The Overpass API supports an around keyword (see Overpass Turbo for a visualization of the example) and of course instead of a place you can also specify a bounding box. Various output formats are supported.

Example:

[out:json]
;
node["name"="Leipzig"];
(
  node
    (around:150)
    ["amenity"~"bank|restaurant"];
  way
    (around:150)
    ["amenity"~"bank|restaurant"];
  relation
    (around:150)
    ["amenity"~"bank|restaurant"];
);
out body;
>;
out skel;

This query returns all bank and restaurant within a distance of 150 meter around any node with the name Leipzig.

Or another query using a bounding box instead of an object:

[out:json]
;
(
  node
    ["amenity"~"bank|restaurant"]
    (51.335,12.368,51.345,12.378);
  way
    ["amenity"~"bank|restaurant"]
    (51.335,12.368,51.345,12.378);
  relation
    ["amenity"~"bank|restaurant"]
    (51.335,12.368,51.345,12.378);
);
out body;
>;
out skel;

answered 21 May '13, 06:26

scai's gravatar image

scai ♦
33.3k21309459
accept rate: 23%

edited 21 May '13, 19:19

1

First, thank for your answer.It's very helpful to me . One more question.How about Search with exactly lat and long , not an exactly node's name. Thanks

(21 May '13, 10:21) TuanDM
1

You can also specify a bounding box as already explained. I updated my answer with a bbox example.

(21 May '13, 12:33) scai ♦
1

Might want to add ways to that query. If the buildings are mapped then, as I understand it, the POI (restaurant, bank, etc.) may (should) be tagged on the way instead of on a node.

(21 May '13, 17:04) n76
1

I updated both examples to search for nodes, ways and relations.

(21 May '13, 19:19) scai ♦

Source code available on GitHub .