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

Upload multiple nodes/ways/relations with one connection #101

Open
b-jazz opened this issue Feb 17, 2019 · 10 comments
Open

Upload multiple nodes/ways/relations with one connection #101

b-jazz opened this issue Feb 17, 2019 · 10 comments

Comments

@b-jazz
Copy link

b-jazz commented Feb 17, 2019

Wouldn't it be much faster to update several objects with a single call instead of doing NodeUpdate after NodeUpdate after NodeUpdate? Maybe have a NodesUpdate([node1, node2, ...]) call that would bundle that up into a single connection/upload to OSM servers.

@austinhartzheim
Copy link
Contributor

Unless I am mistaken, there doesn't seem to support for bulk editing via the API this library depends on. If this feature is important for your use case, you might consider opening an issue on this repository. If a bulk edit endpoint is added to the API, that would open the possibility of supporting the feature here.

I will note that this library takes advantage of HTTP connection reuse, which is significantly faster than opening a new connection for each request. A bulk edit endpoint would likely be even faster, but it's not clear how much faster it would be without further investigation.

More immediately, you might find some of the links here to be useful if you are hoping to perform large edits via the API.

@b-jazz
Copy link
Author

b-jazz commented Feb 19, 2019

It makes sense that the API wouldn't support it, so I would understand if this gets closed. But I did notice the bit in the wiki that states, "You can also use the API to upload a change set in an atomic manner." I was kind of assuming that might be what JOSM does, so I figured if y'all use the same API, that this library could also build an atomic changeset.

As it stands, I won't be too sad if this doesn't get implemented. Just throwing it out there in case it was possible and someone wanted to tackle it.

@mmd-osm
Copy link

mmd-osm commented Feb 19, 2019

Every editing application (iD, JOSM,...) uses diff upload these days: https://wiki.openstreetmap.org/wiki/API_v0.6#Diff_upload:_POST_.2Fapi.2F0.6.2Fchangeset.2F.23id.2Fupload which allows uploading multiple changes at once.

Rather than doing this in python you could of course use some scripting in JOSM, as an example, and validate the results in an editor before uploading.

@susrisha
Copy link
Contributor

I tried looking at ChangesetUpload api here. Looks like it was supposed to allow bulk updates. However, when I tried to do it, it only allows creating a single node at a time. There is an issue in the code. Specifically here..

for change in ChangesData:
            data += "<" + change["action"] + ">\n"
            change["data"]["changeset"] = self._CurrentChangesetId
            data += xmlbuilder._XmlBuild(
                change["type"], change["data"], False, data=self
            ).decode("utf-8")
            data += "</" + change["action"] + ">\n"
        data += "</osmChange>"

I will be more than happy to help in this regard. Do let me know if I can submit a pull request

@metaodi
Copy link
Owner

metaodi commented Dec 21, 2023

@susrisha Sure go ahead with a PR, this would be great 😃

@susrisha
Copy link
Contributor

#155 - There you go :)

@susrisha
Copy link
Contributor

@metaodi any update on the PR ??

@metaodi
Copy link
Owner

metaodi commented Dec 26, 2023

Not yet, didn't have the time to review it. I'll try to get back to you in a few days.

@susrisha
Copy link
Contributor

Hey @metaodi can you please have a look at the PR?

@metaodi
Copy link
Owner

metaodi commented Mar 28, 2024

#155 is the basis for this change, next up are changes needed in the "API"-methods for nodes/ways/relations to actually benefit from this new capability.

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

No branches or pull requests

5 participants