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

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%


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;
permanent link

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 ♦

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:

×710
×36

question asked: 21 May '13, 03:58

question was seen: 6,204 times

last updated: 21 May '13, 19:19

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