Ticket #2013 (closed enhancement: fixed)
[PATCH] Opening compressed OSM files (.osm.bz2)
| Reported by: | Vidar Gundersen | Owned by: | Vidar Gundersen |
|---|---|---|---|
| Priority: | minor | Component: | Core |
| Version: | latest | Keywords: | compression, bzip2, gzip |
| Cc: | henrik.niehaus@… |
Description
Support for opening bzip2 (and gzip) compressed OSM+XML files, as used for snapshots and diffs.
Attachments
Change History
comment:3 Changed 3 years ago by anonymous
I would like this enhancement too, as my favorite tool mkgmap reads *.osm.gz files too.
Implementation should not be very difficult, as least for *.gz, as java has internal support for it. See GZIPInputStream class, it can decompress on the fly. See splitter project for example use. ( http://www.mkgmap.org.uk/svn/wsvn/splitter/src/uk/me/parabola/splitter/Main.java) bottom of file.
comment:4 Changed 3 years ago by anonymous
Hi, I find this requested feature useful too, because splitter can so process bz2 compressed files without converting them to gzip or even raw osm data.
I implemented it in my own version of splitter:
you need: import org.apache.tools.bzip2.*;
and add in module main - openFile the following:
| name.endsWith(".bz2")) |
try {
is.read(); is.read(); is = new CBZip2InputStream(is);
} catch .........
This saves my a lot of map generation time and also free my disks.
comment:5 Changed 3 years ago by avar
Here's a patch to mkgmap to include both the required org.apache.tools.bzip2.* classes and support in mkgmap.
Perhaps you could provide a similar patch to JOSM?
comment:6 Changed 3 years ago by hampelratte
I have created a patch, which adds read and write support for .osm.gz and .osm.bzip2. It uses the bzip streams from ant, which are included, too.
comment:7 Changed 3 years ago by anonymous
- Summary changed from Opening compressed OSM files (.osm.bz2) to [PATCH] Opening compressed OSM files (.osm.bz2)
comment:9 Changed 3 years ago by stoecker
I'm not yet happy with adding the BZIP2 code directly into josm? An external link to apache svn would be nicer, as this would also allow updates and bug-fixes.
comment:10 Changed 3 years ago by Henrik Niehaus <henrik.niehaus@…>
I have added the apache code to create a runnable piece of code, but linking it in as an external definition in the SVN repo should work, too.
http://svnbook.red-bean.com/nightly/de/svn.advanced.externals.html http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools/bzip2/
comment:11 Changed 3 years ago by stoecker
- Owner changed from framm to Vidar Gundersen
- Status changed from new to needinfo
Ok, I finally decided to include it into josm. But now the code is outdated due to changed in file import. Could you please update the stuff to recent JOSM?
Changed 3 years ago by Henrik Niehaus <henrik.niehaus@…>
-
attachment
josm_gzip_bzip2_support.diff.2.gz
added
comment:12 Changed 3 years ago by Henrik Niehaus <henrik.niehaus@…>
I have modified the patch. The classes from apache ant are included again. You may decide to use them or to establish a svn import as discussed before.
comment:13 Changed 3 years ago by stoecker
- Status changed from needinfo to closed
- Resolution set to fixed
In r1653.
comment:14 Changed 3 years ago by stoecker
Sorry, forgot to mention you and the ticket in SVN commit.


