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

Hi! I'm using a php script to get node, way and rel from osm. This script use this url:

$url = 'http://overpass-api.de/api/interpreter?data=[out:json];(%20node%20[%22historic%22]%20('.$coo['min_lat'].','.$coo['min_lon'].','.$coo['max_lat'].','.$coo['max_lon'].');%20way%20[%22historic%22]%20('.$coo['min_lat'].','.$coo['min_lon'].','.$coo['max_lat'].','.$coo['max_lon'].');%20rel%20[%22historic%22]%20('.$coo['min_lat'].','.$coo['min_lon'].','.$coo['max_lat'].','.$coo['max_lon'].');%20);%20(._;%3E;);%20out;';

Now I would to add some tag and not only historic. Can I use a single url or have I to create a query for each tag I need? Thanks, Mk

asked 18 Jul '16, 11:18

bbg5ne's gravatar image

bbg5ne
26112
accept rate: 0%

edited 18 Jul '16, 11:24

scai's gravatar image

scai ♦
33.3k21309459


You can combine as many queries as you want in a union:

http://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#Union

Here's an Overpass Turbo Wizard generated example:

http://overpass-turbo.eu/s/hmK

Also, note the "raw data directly from Overpass API" option in the Export dialog. You can use Overpass Turbo to test out queries and then quickly get the query as a url.

permanent link

answered 18 Jul '16, 20:58

maxerickson's gravatar image

maxerickson
12.7k1083176
accept rate: 32%

mmm ... ok so my $url become

        $url = 'http://overpass-api.de/api/interpreter?data=[out:json];('.
        '%20node%20[%22historic%22]%20('.$coo['min_lat'].','.$coo['min_lon'].','.$coo['max_lat'].','.$coo['max_lon'].');'.
        '%20way%20[%22historic%22]%20('.$coo['min_lat'].','.$coo['min_lon'].','.$coo['max_lat'].','.$coo['max_lon'].');'.
        '%20rel%20[%22historic%22]%20('.$coo['min_lat'].','.$coo['min_lon'].','.$coo['max_lat'].','.$coo['max_lon'].');'.
        '%20node%20[%22church%22]%20('.$coo['min_lat'].','.$coo['min_lon'].','.$coo['max_lat'].','.$coo['max_lon'].');'.
        '%20way%20[%22church%22]%20('.$coo['min_lat'].','.$coo['min_lon'].','.$coo['max_lat'].','.$coo['max_lon'].');'.
        '%20rel%20[%22church%22]%20('.$coo['min_lat'].','.$coo['min_lon'].','.$coo['max_lat'].','.$coo['max_lon'].');'.
        '%20);%20(._;%3E;);%20out;';

now, is it possibile so specify ('.$coo['min_lat'].','.$coo['min_lon'].','.$coo['max_lat'].','.$coo['max_lon'].') only time, maybe at the end url? Thanks!

(19 Jul '16, 14:31) bbg5ne
1

Yes, that's called Global bounding box and described here.

(19 Jul '16, 19:20) mmd
Your answer
toggle preview

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:

×483
×191
×53

question asked: 18 Jul '16, 11:18

question was seen: 3,617 times

last updated: 19 Jul '16, 19:20

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