Skip to content

Instantly share code, notes, and snippets.

@simboli
Created October 14, 2019 19:14
Show Gist options
  • Save simboli/a46f83231a4244613c204fbca27b6dda to your computer and use it in GitHub Desktop.
Save simboli/a46f83231a4244613c204fbca27b6dda to your computer and use it in GitHub Desktop.
Query for Overpass API to get bars and cafes in a specific area
[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"="015146"]->.boundaryarea;
( node(area.boundaryarea)[railway=subway_entrance];
way(area.boundaryarea)[railway=subway_entrance];
>;
) ->.sub_entrance;
(
way(around.sub_entrance:50)[amenity=cafe];
node(around.sub_entrance:50)[amenity=cafe];
relation(around.sub_entrance:50)[amenity=cafe];
way(around.sub_entrance:50)[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