NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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's gravatar image

alisvndk88
11335
accept rate: 0%

edited 11 Jan '22, 20:39


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.

permanent link

answered 11 Jan '22, 22:42

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

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

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×710
×199

question asked: 11 Jan '22, 20:38

question was seen: 1,993 times

last updated: 12 Jan '22, 12:21

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum