-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add button for complete member download. #5420
Comments
I've been thinking about this.. I'm very interested to get #5180 merged and add some kind of background worker queue to iD. (chatted with @kepta about this recently) This would let us download relations in the background, especially for the extra-problematic kinds like routes and multipolygons. I agree we can use the /full call, which should be pretty quick. Maybe we should set a rule like "don't use the /full call for a relation with more than 2000 children" (to prevent iD from getting stuck near coastlines or whatever). My goal really would be to never even need to bother the user with asking them to download relations. |
We can't limit the number of children including indirect ones, and for the number of direct ones, we do likely need to be much more restrictive. 2000 way members with 2000 nodes each would result in loading 4 million nodes into the graph. Typical numbers would be much smaller, but some nearly worst case situations might exist. The api timeout isn't really protective. When issuing the call, the relation itself has already been downloaded. Therefore, we can count the number of member nodes, ways, and relations separately in advance. We do not need to care about the (direct) member nodes. Member relations are larger, but unlikely an issue, because the API call doesn't recursively include their members. The number of member ways is what needs to be limited, because they can potentially result in loading a large amount of nodes. If we can't use the relation/full we should use the following steps:
We can't just issue a relation/full call for each member relation to replace steps 3. and 4. because we can't know whether the call would last too long. |
Calling way/full for each way member can in fact be much slower than calling relation/full for the whole relation, though it is very difficult to estimate the expected runtime. I used https://www.openstreetmap.org/relation/148838 as an example, which has some 700+ way members: Download full relation via relation/full
real 0m14,220s Download each member way via way/full
real 1m13,926s By the way, JOSM seems to use a slightly different approach: multi fetch all member ways, and then lots of multi fetch calls to download all unknown node ids (subject to URL GET parameter size limits). |
Parent relation of downloaded elements, which haven't already been in the graph, would still be missing anyway. To get the parents we would need to issue a subsequent (relations for element) API call foreach downloaded element, recursively including new results of this step. We can skip the download of parent relations, and flag downloaded elements in the graph to have incomplete parent relations. iD's operations would need to be modified to respect this flag. Another approch would be to store the downloaded elements separately from the graph. |
As someone who routinely loads large route relations into iD, I’m not terribly concerned about the potential performance hit from pushing the proposed button. The user has opted into it by pressing the download button. It would be more surprising to the user if we automatically download members in the background (#6656). In fact, you get all the members today when you open iD with a |
There is now (#10149) a button to download all members of a relation in the list of relations of a selected entity. Here it is in action: ![]() I'm reopening the issue as there are also use cases for a similar button on the members list of a selected relation, which is currently still missing. |
The "all members" section has recently got buttons to download individual members. This is a nice improvement, but doesn't cover many usecases well, which need downloading all members.
Full member download buttons should be added to
This one might be the most important case. E.g. potential polygon operations like splitting or merging require multiple operands, and completely downloaded relations.
To prevent blocking the UI a long time, limit using the full relation API call to reasonable low member counts. For larger relations start downloading in small portions consecutively, and stop downloading when the user clicks elsewhere.
To prevent overloading the graph:
Short term solution: stop downloading when a fixed limit of loaded nodes is reached.
Long term solution: Do not load the elemnts into the graph, but a graph extension data structure.
The graph needs to get a second (sub)set of functions, which do also work with the elements of the graph extension. Some operations have to use these extended functions, but rendering etc. can continue to use the normal graph.
The text was updated successfully, but these errors were encountered: