Hi, I am quite new to this forum, sorry if I make any mistake. Currently I am using overpy package in python to query osm. I can get and use query results and it is quite useful for my purpose. I am using offline query with docker image. However, I'd like to modify the .osm file in which I extracted from <name>.osm.bz2 format. As far as I see, there is no query like API for writing, and update of the map is done via website or 3rd party tools like JOSM... I am able to parse xml file, find/get the corresponding node and edit that node/way. However, how can I add new node or remove a node from a way? I know that each way/node IDs are unique. So, I cannot directly add new node to .xml with an arbitrary ID. Is there a way to do this? Thanks. asked 11 Jan '22, 20:38 alisvndk88 |
You can create nodes with arbitrary IDs (that are not already used in your file) and add them to a way in your XML, or remove nodes from a way as you please as long as you're not planning to upload the file to OSM. You can also use JOSM to modify a local osm file; if you create new objects in JOSM, it will assign negative IDs. answered 11 Jan '22, 22:42 Frederik Ramm ♦ This is not an answer for me. The .osm file I'm using is quite lage(country). I'll need to use this local file in the future over and over again. So, ID's are important and adding new node will not be easy for a .osm file with large scale. Isn't there a way or API for this purpose to add/remove/update from python etc.?
(12 Jan '22, 06:55)
alisvndk88
2
The OSM website (and with it, the API and database) is open source (https://github.com/openstreetmap/openstreetmap-website). You can install your own version locally, populate that with OSM data, and then use it. You can even set up a local Overpass instance fed by that data. But it is a complex system and maybe overkill for your purpose. In general, keeping your own modified version of OSM data around is often not a good idea since the moment you start making local modifications, you're losing any ability to update your data from OSM in the future.
(12 Jan '22, 08:39)
Frederik Ramm ♦
I think osmapi python module is doing exactly what I want. It has ability to update the map using credentials...
(12 Jan '22, 12:21)
alisvndk88
|