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

I want to merge two osm files (a certain area and the corresponding contour lines). The purpose is to create a combined osm file to be further processed with mkgmap.

Situation The first file is a regular osm file coming from Overpass Turbo (with Meta attributes). The second was originally an shp file with contour lines of the same area, coming from a cartographic server of my region. I opened it in JOSM with the plugin OpenData and saved it as osm. Correctly, JOSM creates id's for each object, but not a "Version" attribute.

Problem I want to merge both files using a command line program under Windows. I tried with Osmosis, but it fails because of the missing Version attributes in the second file. Any suggestion on how to force JOSM to produce Version attributes or to convince Osmosis to ignore the missing attributes?

asked 28 Jan '20, 11:47

stenan's gravatar image

stenan
11112
accept rate: 0%


I would try to open both files in JOSM and merge the layers with it.

permanent link

answered 28 Jan '20, 13:34

H_mlet's gravatar image

H_mlet
5.4k1781
accept rate: 13%

Thanks, but this is not the idea. Maybe I should add a bit of context. I'm a hiking guide. Every time I explore a new hike, I want to have a fresh Garmin map for the area. Of course, paths change frequently, but contour lines don't. Thus, the process should look like this:

  • I prepare just one time a big osm file with contour lines for the whole mountain area.
  • I prepare some scripts to run on the command line (on Windows), where the only parameter I have to change every time is the bounding box related to the small area which includes my new hike. Before every hike, I just want to run the scripts and produce quickly and with a semi-automated process a fresh Garmin map, ready to install. The scripts should do the following, in sequence:

A. launch wget to download an up-to-date osm file related to the small area of my interest B. launch osmconvert to cut the big osm file with the contour lines along the same bounding box C. launch osmosis (or similar) to merge the two osm files D. launch mkgmap to produce the map using a proper style sheet

Point C is where I'm stuck because of the missing Version attributes. All the rest works well.

Thanks

(28 Jan '20, 16:04) stenan

I think you can fake version ids with osmconvert, see --fake-version here http://manpages.ubuntu.com/manpages/trusty/man1/osmconvert.1.html

(28 Jan '20, 20:32) SK53 ♦

Right, sorry I did not pay enough attention to the stance "command line program under Windows."

I was going to suggest osmium, as I've read it's much more flexible than osmosis, but I don't see any windows version.

As .osm is just xml, I think it should be quite easy to add a dummy Version attribute (put "1" everywhere). I would use sed, but if don't already have cygwin, it will be complicated. But search and replace tools must exists for windows.

You might also find an xml tool for windows commandline.

Regards.

(28 Jan '20, 21:06) H_mlet
Your answer
toggle preview

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:

×252
×41
×26
×5

question asked: 28 Jan '20, 11:47

question was seen: 1,819 times

last updated: 28 Jan '20, 21:06

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