Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make MAX_NODES and MAX_AREA values configurable #84

Closed
pnorman opened this issue Nov 1, 2013 · 0 comments · Fixed by #232
Closed

Make MAX_NODES and MAX_AREA values configurable #84

pnorman opened this issue Nov 1, 2013 · 0 comments · Fixed by #232

Comments

@pnorman
Copy link
Contributor

pnorman commented Nov 1, 2013

Currently we define

#define MAX_AREA 0.25
#define MAX_NODES 50000

with the logic

int num_nodes = sel.select_nodes_from_bbox(b, MAX_NODES);
if (num_nodes > MAX_NODES) {
  throw http::bad_request(
    (format("You requested too many nodes (limit is %1%). "
            "Either request a smaller area, or use planet.osm")
            % MAX_NODES).str());
}

We've said it would be good to the max values configurable before, but now I have a project that could use it, so I have some motivation to fixing it.

I think it makes sense to change where the logic is being evaluated at the same time.

You can imagine a backend which caches in a tiled schema so it makes sense to return a larger area than requested for small requests. This could mean that for an area with an exceptionally high node density that the number of nodes selected will always be >MAX_NODES.

Another example is a backend that somehow knows that a particular request will be more than MAX_NODES without running it. It would be foolish to run it, but the number of nodes selected for select_nodes_from_bbox would be 0.

This could be accommodated by changing select_nodes_from_bbox(b,MAX_NODES) to throw http::bad_request itself

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants