#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 Changed 14 years ago by
Type: | defect → enhancement |
---|
comment:2 Changed 14 years ago by
Priority: | major → minor |
---|
comment:3 Changed 14 years ago by
comment:4 Changed 14 years ago by
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 14 years ago by
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 14 years ago by
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.
Changed 14 years ago by
Attachment: | josm_gzip_bzip2_support.diff.gz added |
---|
comment:7 Changed 14 years ago by
Summary: | Opening compressed OSM files (.osm.bz2) → [PATCH] Opening compressed OSM files (.osm.bz2) |
---|
comment:8 Changed 14 years ago by
Cc: | hampelratte added |
---|
comment:9 Changed 14 years ago by
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 14 years ago by
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 14 years ago by
Owner: | changed from framm to Vidar Gundersen |
---|---|
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?
Changed 14 years ago by
Attachment: | josm_gzip_bzip2_support.diff.2.gz added |
---|
comment:12 Changed 14 years ago by
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.