User:Chuckfinley71/Overpass Queries

From OpenStreetMap Wiki
Jump to navigation Jump to search


Overpass Query What it finds
try it yourself in overpass-turbo
/* Reference source: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example#Banks_far_away_from_police_stations */

[out:json][bbox:{{bbox}}];

// 🏢 determine set of retail/commercial buildings without a name
nwr["building"~"^(retail|commercial|yes)$"][!name]->.retailBuildings;

// determine set of amenities
nwr["amenity"]->.amenities;
// determine set of shops
nwr["shop"]->.shops;

// determine set of buildings containing shop nodes
.shops is_in->.buildingsContainingShops;
// determine set of buildings containing amenity nodes
.amenities is_in->.buildingsContainingAmenities;

// determine buildings that aren't already tagged
//((.retailBuildings; - .buildingsNearAmenities;); - .buildingsNearShops;);
((.retailBuildings; - .buildingsContainingAmenities;); - .buildingsContainingShops;);

// return node, ways, relations as determined above
out geom meta;

// 🍟 find amenities without a name. excluding types such as parking which are not expected to have a name
(nwr.amenities["amenity"!~"^(compressed_air|parking|shelter|vacuum_cleaner|toilets|school|post_box|parking_space|parking_entrance|waste_basket|drinking_water|bench|fountain|bicycle_parking|recycling|shelter|vending_machine|hunting_stand|waste_disposal|telephone)$"][!name];);
out geom meta;

// 🛒 find shops without a name. 
(nwr.shops["shop"][!name];);
out geom meta;


{{style: 

/* colorize potentially undermapped commercial/retail buildings */
way[building=retail],
way[building=commercial]
{ color:orange; fill-color:blue; }

/* lower visual priority of generic untagged buildings */
way[building=yes]
{ symbol-fill-opacity:0.1; symbol-stroke-opacity:0.25;}

/* prioritize shops and amenities */
way[amenity],
node[amenity],
way[shop],
node[shop]
{ fill-color:red;}

}}
This query attempts to find undermapped areas by locating building=* that do not have a name or amenities/shops tagged within them. Additionally, amenities and shops without a name are identified.