plepe / OpenStreetBrowser

An application to ‘browse’ the information in the displayed part of the map. Similar to common Wikis and also the main page of http://www.openstreetmap.org the website shows a narrow menu on the left side, most of the page is used for the display of the map. In contrast to most Wikis the menu is not static, but rather the content of the map can be browsed in categories. For the map a special style has been developed (sorry guys, I neither like the default Mapnik nor Osmarender styles), and special overlays are displayed to support the current browsed categories. When you click on an object (either from the list or directly on the map) informations on this object are displayed.
http://www.openstreetbrowser.org
GNU General Public License v3.0
86 stars 20 forks source link

Filter map features inside region / near other map feature #95

Open plepe opened 5 years ago

plepe commented 5 years ago

Juergeen wrote on 2019-02-17 in the OSM Wiki:

Is it possible to filter the nodes found by their distance to some specific way, for instance to show alle the hotels next to or near a road ? Not fltering on a low zoom level that shows a long road overloads my browser, and, probably, also the server. The distance should be defined as the distance from each node to the closest point of the way. Because this is not easy to calculate, we might relax this definition to the distance to the closest endpoint of any path that is part of the way: This seems easier to calculate and doesn't make a difference on a low zoom level.

plepe commented 5 years ago

My respone on 2019-02-18:

Hmm, interesting. Do you mean as a special category which shows e.g. all address nodes which belong to a street or more a general selection which applies to all categories? I could image a button (or so) which restricts the query to all objects within an (adminstrative) boundary, a custom bounding box or - as you suggested - close to a node / way (e.g. street).

Juergeen commented 5 years ago

No, I did not mean a special category to show all address nodes that belong to some way. What I'm looking for is to filter any items defined by an existing category or query (in my case, hotels) further by their distance to a particular way being under a limit (in my case, let's say, 2 or 5 km).

In my real case I want to plan a 3-day tour on a bicycle path being about 250 km long. What I want to find are land hotels in beautiful areas outside larger cities, but near that path.

Limiting hotels found to within some administrative bounday or bounding box is not helpful here, because that would return way too much hits inside larger cities. When zooming in to restrict the number of hits to those next to that bicycle path causes a loss of general overview and is tedious.

Because I'm a software developer, I would be perfectly happy with some very complicated search syntax to be entered into the definition of my self-defined category: I do not need any user interface (button or so).

plepe commented 5 years ago

I see. I think this is a very useful feature and I would love to implement this in OpenStreetBrowser, but I'm sure this won't happen anytime soon.

But there's help :-)

You can use Overpass Turbo to achieve this. Use this query:

[out:json];
relation(6562780); // replace this by the ID of your bicycle route relation
out geom; // remove this to hide the relation
nwr(around:200)[amenity=restaurant]; // 200 is the max distance in meters, replace `amenity=restaurant` by `tourism=hotel` or `tourism~"^(hotel|hostel|motel)$"`.
out geom;

More info on this query language: https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL

I hope I could help :-)

plepe commented 5 years ago

And, did you achieve what you wanted?