Hi,

I am a volunteer in my small city for the security committee.

We have a school near a "main" road and there is some security issue with the students and the traffic. A new planned development will increase dramatically the traffic in the next year.

I would like to search other city in the area, state, where a school is close to a main road (sometimes the postal address might be on a perpendicular street).

I tried using nominatim, but I don't think I have the correct coding sentence. I can find school in cities or area, but not based on the street type.

Any help ?

asked 27 Dec '18, 15:39

Watever's gravatar image

Watever
11112
accept rate: 0%

edited 27 Dec '18, 19:06

SimonPoole's gravatar image

SimonPoole ♦
37.3k13281594


This is likely difficult to do in a meaningful way, but you will get some hits with an adaption of https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example#Banks_far_away_from_police_stations

See http://overpass-turbo.eu/s/ENe

[out:json][timeout:25];
// gather results
(
  node[amenity=school]({{bbox}});
  way[amenity=school]({{bbox}});
  rel[amenity=school]({{bbox}});
)->.schools;
(
  way[highway=primary]({{bbox}});
)->.primaries; //

(
  node.schools(around.primaries:200);
  way.schools(around.primaries:200);
  rel.schools(around.primaries:200);
);
// print results
out body;
>;
out skel qt;

This will give you all schools in the bounding box that are near (200m) to a primary road.

permanent link

answered 27 Dec '18, 19:19

SimonPoole's gravatar image

SimonPoole ♦
37.3k13281594
accept rate: 19%

edited 27 Dec '18, 19:19

Thank you very much !

(04 Jan, 02:51) Watever

This worked. I changed it to have it for 25 meters only. That way it limit the results and remove the school that are really close but not perpendicular.

I have been playing for over 2-3 hours to get some of the data out. I couldn't find how to send to csv, it also seems most of the schools outside of the large cities don't have much tags.

I was hopping to have address or coordinates, so the other members can see the location on google map and use google street view.

I got results in json, then using http://geojson.io, send it to CSV with all the coordinates. But theses do not work in google map. I am getting results in antarctica... Getting a little confuse now.

(04 Jan, 02:57) Watever
1

why don't you try http://umap.openstreetmap.fr instead of Google ?

Are you sure that you did not switch lat/long, or that your workflow did not replace a decimal dot with a comma or another mistake in lat/long expectations of G-maps.

(04 Jan, 04:16) escada

Did you mix lat and lon?

For CSV output use [out:csv(...)] in combination with out center. Example:

[out:csv(::id, ::type, ::lat, ::lon, amenity, name)][timeout:25];
// gather results
(
  node[amenity=school]({{bbox}});
  way[amenity=school]({{bbox}});
  rel[amenity=school]({{bbox}});
)->.schools;
(
  way[highway=primary]({{bbox}});
)->.primaries; //

(
  node.schools(around.primaries:200);
  way.schools(around.primaries:200);
  rel.schools(around.primaries:200);
);
// print results
out center;
(04 Jan, 07:54) scai ♦
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:

×534
×103
×76
×17
×13

question asked: 27 Dec '18, 15:39

question was seen: 329 times

last updated: 04 Jan, 07:57

powered by OSQA