<div dir="ltr"><div dir="ltr"><div>Hi Mateusz,</div><div>Overpass API has already built-in functionality to search for such cases.</div><div><br></div><div>See: <a href="https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example#Banks_far_away_from_police_stations">https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_API_by_Example#Banks_far_away_from_police_stations</a><br></div><div><br></div><div>It's also possible to do so with PostGIS, but keeping in mind a few caveats:</div><div>- Don't use ST_Buffer, even if it seems natural (for me it did first time) - it will unnecesarily generate a geometry. Use an anti-join along the lines of:<br></div><div>SELECT id, someColumn, geom FROM table a LEFT JOIN table b ON ST_DWithin(a.geom,b.geom,20) AND b.field = bCondition WHERE <a href="http://b.id">b.id</a> IS NULL and a.anotherField = aCondition</div><div>- Obviously Mercator meters are shorter, you can either compensate for the average if your region of analysis is small, or use Mapbox's helper MercDWithin, or use national coordinate system (e.g. EPSG:2180) when importing with osm2pgsql.</div><div>- The above query relies on spatial indexes, for larger sets you can try to get better performance by dumping A and/or B sets into tables or materialized views (beware, these need to be refreshed manually) and creating a spatial index on them.</div><div><br></div><div>Hope this helps.</div><div><br></div><div>MichaƂ<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Apr 1, 2019 at 10:49 PM Mateusz Konieczny <<a href="mailto:matkoniecz@tutanota.com">matkoniecz@tutanota.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div>
<div><div>Is anyone aware about tool that takes as input two sets of OSM tags and will output<br></div><div>visualization of data split into two groups<br></div><div><br></div><div>- objects with tags from set A, more than X meters from any object with tags from set B<br></div><div>- objects with tags from set A, no more than X meters from any object with tags from set B<br></div><div><br></div><div>?<br></div><div><br></div><div>For example<br></div><div><br></div><div>- highway=bus_stop for set A<br></div><div>- highway=service/residential/unclassified/tertiary/... for set B<br></div><div>- 20m as distance parameter<br></div><div><br></div><div>This one would allow to list bus stops that are suspiciously far away from roads.<br></div><div><br></div><div>In my case it would be "public objects without nearby bicycle parkings".<br></div><div>--------<br></div><div>Though, given that it seems to be build from 4 relatively simple steps it is likely that <br></div><div>nobody who did it bothered to publish any part as a project.<br></div><div><br></div><div>But if anyone see something stupid in my plan below - let me know!<br></div><div><br></div><div>All parts of that are fairly easy<br></div></div><div><br></div><div>- build list of tags indicating major public objects (shop=*, amenity=place_of_worship,<br></div><div>amenity=restaurant, amenity=pharmacy, amenity=bar etc) [1]<br></div><div>- download data [2]<br></div><div>- run query to find public objects with/without nearby bicycle parkings [3]<br></div><div>- generate visualization depicting this data [4]<br></div><div><br></div><div><br></div><div><div><a href="https://github.com/Leaflet/Leaflet.markercluster" target="_blank">https://github.com/Leaflet/Leaflet.markercluster</a><br></div><div><br></div></div><div>[1] is fairly simple, just go through preset of Vespucci or some other editor<br></div><div>(though if anyone knows about listing of such tags - let me know)<br></div><div>[2] probably just download extract of some region and load into database<br></div><div>[3] postgis queries (ST_Buffer to build areas + ST_Within)?<br></div><div>Though it would get fun if I would start looking for <br></div><div>"bicycle parking within X meters from entrance to a public object"<br></div><div>[4] <a href="https://github.com/Leaflet/Leaflet.markercluster" target="_blank">https://github.com/Leaflet/Leaflet.markercluster</a> for an initial version looks good enough<br></div>  </div>

_______________________________________________<br>
dev mailing list<br>
<a href="mailto:dev@openstreetmap.org" target="_blank">dev@openstreetmap.org</a><br>
<a href="https://lists.openstreetmap.org/listinfo/dev" rel="noreferrer" target="_blank">https://lists.openstreetmap.org/listinfo/dev</a><br>
</blockquote></div>