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

Hello, i want to collect all points that have "amenity=school" as tag and i created the following raw data URL:

http://overpass-api.de/api/interpreter?data=[out:json];(node[amenity=school];>;way[amenity=school];>;relation[amenity=school];>;);out;

But it should show all schools in the world! How to set the search to a certain country?

I said "should" before because i get a timeout error and i can't see what is the output. Setting an area i could get rid of timeout error... am i right?

asked 25 Jun '15, 09:14

Andreanovenove's gravatar image

Andreanovenove
126101118
accept rate: 0%

edited 25 Jun '15, 09:14

1

It is possible to increase the timeout.

(29 Jun '15, 07:39) scai ♦

Overpass Turbo can filter the results to a bbox, or to the result of a nominatim query. Read more here.

For your example I think if you use this Overpass Turbo query it will find all schools in Boliva. Adjust for the country you want:

[out:json];{{geocodeArea:Bolivia}}->.searchArea;(node[amenity=school](area.searchArea);>;way[amenity=school](area.searchArea);>;relation[amenity=school](area.searchArea);>;);out;
permanent link

answered 25 Jun '15, 10:43

rorym's gravatar image

rorym
5.4k1449100
accept rate: 11%

It seems to work and it doesn't give problems about timeout. Why?

(25 Jun '15, 11:04) Andreanovenove

Since you're only loading data from one country, the query will take much less time to execute, so probably doesn't hit the Overpass Turbo timeout limit?

(25 Jun '15, 11:05) rorym

Looks like URL encoding of all the newlines and spaces. Maybe try to remove them?

(25 Jun '15, 12:54) rorym

It collects even nodes without any references to "amenity:school" tag. These nodes contain just type, id, lat and lon tags. Why?

(27 Jun '15, 15:24) Andreanovenove
3

Because it also collects ways (and relations) tagged with "amenity=school". The geometry of a way is defined by its referenced nodes. For more info read the section about OSM's basic elements.

(29 Jun '15, 07:38) scai ♦

To parse it i had to create a recursive function in my PHP code that sometime seems not to work. Do you know any workaround to query OSM to get nodes/ways without "duplicates"?

(03 Jul '15, 11:45) Andreanovenove
1

There shouldn't be any duplicates in the data returned. Maybe your parser is broken. The best is to create a new question, provide the data you are trying to parse, explain us your parser and tell us which data is supposed to be duplicated according to your parser. But maybe that's a little bit too much for this help system and a forum or mailing list would be better.

(03 Jul '15, 11:54) scai ♦
showing 5 of 7 show 2 more comments

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:

×213
×94
×58
×9

question asked: 25 Jun '15, 09:14

question was seen: 9,728 times

last updated: 04 Jul '15, 11:10

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