===== Using Overpass to extract data from OpenStreetMap ===== I used the following [[https://overpass-turbo.eu/|Overpass]] files to measure the amount of cycle lanes in cities: ==== Total length of highways in Westminster ==== [out:csv(number,length)]; {{geocodeArea:Westminster}}->.searchArea; way["highway"]["highway"!="cycleway"]["highway"!="bridleway"]["highway"!="footway"]["highway"!="path"]["highway"!="service"]["access"!="private"](area.searchArea); make stat number=count(ways),length=sum(length()); out; ==== Total length of segregated cycleways in Westminster ==== [out:csv(number,length)]; {{geocodeArea:Westminster}}->.searchArea; way["highway"="cycleway"]["foot"!="designated"](area.searchArea); make stat number=count(ways),length=sum(length()); out; ==== Total length of segregated cycleways in Camden ==== [out:csv(number,length)]; {{geocodeArea:London borough of Camden}}->.searchArea; way["highway"="cycleway"](area.searchArea); make stat number=count(ways),length=sum(length()); out; ==== Show all segregated cycleways in Westminster on a map ==== Click the zoom icon once generated [out:json]; {{geocodeArea:Westminster}}->.searchArea; ( way["highway"="cycleway"]["foot"!="designated"](area.searchArea); ); out body; >; out skel qt; ==== Show only roads in Westminster on a map ==== [out:json]; {{geocodeArea:Westminster}}->.searchArea; ( way["highway"]["highway"!="cycleway"]["highway"!="bridleway"]["highway"!="footway"]["highway"!="path"]["highway"!="service"]["access"!="private"](area.searchArea); ); out body; >; out skel qt; ==== Show segregated cycle routes on current viewed map ==== [bbox:{{bbox}}]; ( way["highway"="cycleway"]; ); out geom; ==== Search on a previous date ==== [date:"2014-10-27T00:00:00Z"] [out:json][timeout:25]; nwr["amenity"="bank"]({{bbox}}); out geom; ==== Other things I didn't write details for ==== [out:csv(length,value)]; area[name="London"]->.a; way[highway](area.a); for (t["highway"]) { make stat value=_.val,length=sum(length()); out; } [out:csv(length,value)]; area[name="London"]; way[highway="cycleway"]; out for (t["highway"]) { make stat value=_.val,length=sum(length()); out; } [out:csv(length,value)]; area[name="Isle of Man"]->.a; way[highway="cycleway"](area.a); for (t["highway"]) { make stat value=_.val,length=sum(length()); out; } [out:csv(length,value)]; area[name="Isle of Man"]->.a; way[highway="cycleway"](area.a); make stats length=sum(length()); out; [out:csv(length,value)]; area[name="London"] .way[highway="cycleway"] .way[cycleway="sidewalk"]; make stats length=sum(length()); out; [out:csv(length,value)]; area[name="London"]; way[highway="cycleway"](area)->.a; way[highway="cycleway"](area)->.b; way.a.b; make stats length=sum(length()); out; [out:csv(length,value)]; area[name="London"]; way[highway="cycleway"](area)->.a; way[cycleway!="sidewalk"](area)->.b; way[foot!="yes"](area)->.c; way.a.b.c; make stats length=sum(length()); out;