Munging OpenStreetMap Data
Answering an age old question
I like to map things. So finding StreetComplete recently was a treat! In essence, it "gameifies" contributing to OpenStreetMap which is a community driven, open-source map like Google Maps or Apple Maps, but useable by all for free.
A question I've always wondered when driving is "what is the longest 40km/h school zone in NSW?".
This could be answered by driving every road in the state taking measurements. Or, I could download NSW's OpenStreetMap data. Or... I could use Overpass Turbo (thanks to this blog post that mentioned it) which is an interface to quickly query the OpenStreetMap dataset. To find all 40km/h school zones in NSW within 1km of a school, all we need to do is feed it this:
// Limit the search area to NSW area[name="New South Wales"]; // Grab every school in NSW way(area)[amenity=school]->.schools; ( // Get every road that has a conditional speed limit // where the condition string starts with "40" within // one kilometer of a school (to limit false positives) way(around.schools:1000)["maxspeed:conditional"~"^40.*"]; ); // Not sure what these do, but it doesn't work without them (._;>;); out;
Excellent. To answer "what is the longest continuous stretch of 40km/h school zone in NSW" all we need to do is add
make stat longest=max(length()); and we get our answer of 940 meters in "Young" that seems to swing past a Catholic college, a high school and a primary school in quick succession. Also interesting are that there are 2977 40km/h road sections totalling 389km worth across the state.
While we're at it, I had another question. When driving on the M1, there's a section that's speed limited to 90km/h when raining and 100km/h otherwise. Are there any other instances in NSW?