Skip to content

Instantly share code, notes, and snippets.

@simboli
Created October 14, 2019 19:16
Show Gist options
  • Save simboli/fc9fe7dfb5c4044b203210c076718d91 to your computer and use it in GitHub Desktop.
Save simboli/fc9fe7dfb5c4044b203210c076718d91 to your computer and use it in GitHub Desktop.
Query for Overpass API to get bars and cafes in a specific area, inline and parametrized for Google Spreadsheet
=IMPORTDATA("http://overpass-api.de/api/interpreter?data=[out:csv( ::id,""name"",::count,""brand"",""amenity"",""ref:vatin"",""opening_hours"",""operator"",""addr:postcode"",""addr:city"",""addr:street"",""addr:housenumber"",""opening_hours"",""contact:phone"",""contact:website"",::lat,::lon,lastcheck; true; "","" )][timeout:20]; area[admin_level=8][boundary=administrative][""ref:ISTAT""="&B4&"]->.boundaryarea; ( node(area.boundaryarea)[railway=subway_entrance]; way(area.boundaryarea)[railway=subway_entrance]; >; ) ->.sub_entrance; ( way(around.sub_entrance:"&B5&")[amenity=cafe]; node(around.sub_entrance:"&B5&")[amenity=cafe]; relation(around.sub_entrance:"&B5&")[amenity=cafe]; way(around.sub_entrance:"&B5&")[amenity=bar]; node(around.sub_entrance:50)[amenity=bar]; relation(around.sub_entrance:50)[amenity=bar]; ); out center; out count;")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment