Teester / Whats-Nearby

Android App for collecting information about POIs for OpenStreetMap
GNU General Public License v3.0
13 stars 2 forks source link

HTTP User-Agent #1

Closed mmd-osm closed 6 years ago

mmd-osm commented 6 years ago

Your Overpass API requests contain a generic HTTP User-Agent only at this time. Could you please add some information about your app here, so it's easier to contact you in case of issues?

similar to e.g. https://stackoverflow.com/a/5027588/3501889

Teester commented 6 years ago

I've released version 0.7 which adds "User-Agent = whatsnearby/0.7" to the request headers.

I'm interested in the potential impact of the app on the Overpass api. I can't find any way to measure it apart from measuring the length of time a request takes. The requests are all of a form similar to http://overpass-turbo.eu/s/rA1. My testing has shown that they generally take less than 1s each and are around 5Kb or less per request. The app should not query Overpass more often than once per hour and then only if the user has moved far enough from the last location, so I'm expecting around 8-10 requests per user per day at most. And even this might prove to be too much from the perspective of annoying the user with notifications.

I'm going to close this issue as the User-Agent issue has been resolved, but I would appreciate any input you might have regarding the above

mmd-osm commented 6 years ago

I'm going to close this issue as the User-Agent issue has been resolved

Great, thanks for the quick fix.

The number of requests shouldn't cause any issues then. You could maybe experiment with regular expressions and a global bounding box, instead of (around:...) and many single query statements. This should be the fastest way to get query results. The global bounding box should of course somehow match the previous radius.

[out:json][timeout:25]
[bbox:{{bbox}}];
(

  node[~"^(shop|amenity|tourism|leisure)$"~"."];
  way[~"^(shop|amenity|tourism|leisure)$"~"."];
  relation[~"^(shop|amenity|tourism|leisure)$"~"."];
);
out center;
Teester commented 6 years ago

Interesting. Thanks for your input.

I have briefly experimented with using a similar regexp, but given the short query time, it was difficult to see what impact it had. Using a larger bbox (or around value) might provide a better understanding.

In any case, from the perspective of the app, the query time is not particularly important. The user only becomes aware that query has even been run when they are notified about results from it, so it doesn't make much difference if the query time is 0.5s or 5.0s (unless it impacts their data plan).

If using regexp and/or a bbox reduces the load on overpass, I'll definitely consider them. In particular, using the regexp should simplify query generation for me.