Modify

Opened 15 years ago

Closed 15 years ago

Last modified 15 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 15 years ago.
josm_gzip_bzip2_support.diff.2.gz (22.5 KB ) - added by hampelratte 15 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 by anonymous, 15 years ago

Type: defectenhancement

comment:2 by anonymous, 15 years ago

Priority: majorminor

comment:3 by anonymous, 15 years ago

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 by anonymous, 15 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:

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 by avarab@…, 15 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 hampelratte, 15 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 hampelratte, 15 years ago

comment:7 by anonymous, 15 years ago

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

comment:8 by hampelratte, 15 years ago

Cc: hampelratte added

comment:9 by stoecker, 15 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 hampelratte, 15 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 stoecker, 15 years ago

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?

by hampelratte, 15 years ago

comment:12 by hampelratte, 15 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.

comment:13 by stoecker, 15 years ago

Resolution: fixed
Status: needinfoclosed

In r1653.

comment:14 by stoecker, 15 years ago

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. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.