Skip to content
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

Merged
merged 1 commit into from
Jan 20, 2017

Conversation

Piskvor
Copy link
Contributor

@Piskvor Piskvor commented Jan 20, 2017

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.

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
Copy link
Contributor Author

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;
Copy link
Contributor Author

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, that makes sense.

@iandees iandees merged commit 5d1a560 into osmlab:gh-pages Jan 20, 2017
@iandees
Copy link
Member

iandees commented Jan 20, 2017

Thanks again for your contributions!

@Piskvor
Copy link
Contributor Author

Piskvor commented Jan 26, 2017

You're welcome. I'm essentially scratching my own itches - in a mapathon, the issues addressed by the PRs were friction points for us :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants