#2013 closed enhancement (fixed)
[PATCH] Opening compressed OSM files (.osm.bz2)
Reported by: | Vidar Gundersen | Owned by: | Vidar Gundersen |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Core | Version: | latest |
Keywords: | compression, bzip2, gzip | Cc: | hampelratte |
Description
Support for opening bzip2 (and gzip) compressed OSM+XML files,
as used for snapshots and diffs.
Attachments (2)
Change History (16)
comment:1 by , 17 years ago
Type: | defect → enhancement |
---|
comment:2 by , 17 years ago
Priority: | major → minor |
---|
comment:3 by , 16 years ago
comment:4 by , 16 years ago
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 by , 16 years ago
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 by , 16 years ago
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.
by , 16 years ago
Attachment: | josm_gzip_bzip2_support.diff.gz added |
---|
comment:7 by , 16 years ago
Summary: | Opening compressed OSM files (.osm.bz2) → [PATCH] Opening compressed OSM files (.osm.bz2) |
---|
comment:8 by , 16 years ago
Cc: | added |
---|
comment:9 by , 16 years ago
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 by , 16 years ago
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 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → 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?
by , 16 years ago
Attachment: | josm_gzip_bzip2_support.diff.2.gz added |
---|
comment:12 by , 16 years ago
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.
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.