OpenStreetMap Forum

The Free Wiki World Map

You are not logged in.

#1 2019-07-08 18:28:55

gecho111
Member
Registered: 2014-01-30
Posts: 8

How to compact OSM xml files?

I have a few local files that I use for building map overlays for my Garmin.  I just noticed that when I edit files in JOSM it just marks objects as deleted rather than purging them from the file so the file size never decreases.  Is there a utility for purging deleted nodes and ways from a .osm file?

Offline

#2 2019-07-08 21:33:58

Tordanik
Moderator
From: Germany
Registered: 2008-06-17
Posts: 2,409
Website

Re: How to compact OSM xml files?

JOSM has a "purge" action in that's separate from deletion: https://josm.openstreetmap.de/wiki/Help/Action/Purge
To get rid of the elements you've already deleted, give these instructions a try: https://help.openstreetmap.org/question … on-in-josm

Hope it works as intended! Alternatively, I guess you might also be able to "clean up" your file by selecting everything (Ctrl + A), copying (Ctrl + C), creating a new layer (Ctrl + N) and using the "Paste at source position" command (Ctrl + Alt + V) in the new layer. Then save that new layer to file. Double-check if all relations and other complicated elements have survived the procedure, first. (And be sure to have a backup, I've never tried this myself. wink)

Offline

#3 2019-07-08 21:46:09

gecho111
Member
Registered: 2014-01-30
Posts: 8

Re: How to compact OSM xml files?

Purge seems to just be a hard delete for stuff that is still visible in JOSM.  Doesn't have any effect for previously deleted items.

I ended up doing a copy / paste since it was a fairly small area, reducing file from 14 MB to 695 K.

Offline

#4 2019-07-28 16:48:41

GerdP
Member
Registered: 2015-12-18
Posts: 816

Re: How to compact OSM xml files?

If you use mkgmap to process the file it should not matter because mkgmap should ignore data that is not visible.

Offline

Board footer

Powered by FluxBB