-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check if the bounding box size is acceptable to Overpass for filtering: #52
Conversation
requesting a too-large area will result in an empty response, or one that takes way too long. Therefore, guess at area size which can be filtered within reasonable time (2 degrees square, currently). If the bounding box is larger, fall back: request changes for the whole planet and process them client-side - even though it consumes more bandwidth, this is a pre-generated file, thus lower server load.
@@ -52,7 +55,8 @@ var overview_map = L.map('overview_map', { | |||
touchZoom: false, | |||
scrollWheelZoom: false, | |||
doubleClickZoom: false, | |||
boxZoom: false | |||
boxZoom: false, | |||
minZoom: 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A general fix for "loading a large bbox attempts to load an overview map which is zoomed out too much, which also fails". This will force-set the zoom to the minimum, avoiding the issue.
// A guesstimate of the maximum filtered area size that the server would accept. | ||
// For larger areas, we fall back to the global (server-cached) change file | ||
// ...and we process it client-side as usual. | ||
return (width * height) < 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only enforced as a hard limit here - e.g. "3" also kind of works - but I don't want to load the Overpass server too much
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, that makes sense.
Thanks again for your contributions! |
You're welcome. I'm essentially scratching my own itches - in a mapathon, the issues addressed by the PRs were friction points for us :) |
requesting a too-large area will result in an empty response,
or one that takes way too long. Therefore, guess at area size
which can be filtered within reasonable time (2 degrees square, currently).
If the bounding box is larger, fall back: request changes for the whole planet
and process them client-side - even though it consumes more bandwidth,
this is a pre-generated file, thus lower server load.