Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#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)

josm_gzip_bzip2_support.diff.gz (23.1 KB) - added by hampelratte 14 years ago.
josm_gzip_bzip2_support.diff.2.gz (22.5 KB) - added by hampelratte 14 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 Changed 14 years ago by anonymous

Type: defectenhancement

comment:2 Changed 14 years ago by anonymous

Priority: majorminor

comment:3 Changed 14 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 14 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:

if (name.endsWith(".bz")
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 avarab@…

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 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.

Changed 14 years ago by hampelratte

comment:7 Changed 14 years ago by anonymous

Summary: Opening compressed OSM files (.osm.bz2)[PATCH] Opening compressed OSM files (.osm.bz2)

comment:8 Changed 14 years ago by hampelratte

Cc: hampelratte added

comment:9 Changed 14 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 14 years ago by hampelratte

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 stoecker

Owner: changed from framm to Vidar Gundersen
Status: newneedinfo

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 hampelratte

comment:12 Changed 14 years ago by hampelratte

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 14 years ago by stoecker

Resolution: fixed
Status: needinfoclosed

In r1653.

comment:14 Changed 14 years ago by stoecker

Sorry, forgot to mention you and the ticket in SVN commit.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Vidar Gundersen.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.