[josm-dev] Image extraction from TMS cache

Holger Mappt holgerosm at gmx.net
Sun Dec 20 17:33:57 UTC 2015


Hi,

I re-package josm-latest.jar into my cachextractor.jar to have a self 
contained archive. I missed to copy data/preferences.xsd, which killed 
my JOSM preferences. Now I copy directory data in addition to **/*.java 
and the cache read works.

What do I need to do to shut down JOSM if it was started with the 
functions in JOSMFixture.init() (no GUI mode)? Looks like there is a 
background process. I call System.exit(0), but I would like to stop all 
running processes first.

The other thing that caused me some headache was the export disk file 
format. The old cache that wrote tile files to disk wrote *.png files. I 
tried different PNG writers, but my files were always about 8 times 
bigger. It took me some time to figure out that even JPEG files were 
written with the .png file name extension. Now I save the tiles as JPEG 
and everything is fine. Does the current cache have information about 
the original tile file (format, data)?

Regards,
Holger


Am 12.12.2015 um 20:09 schrieb Wiktor Niesiobedzki:
> As for your problem - this is kind of the problem we face also writing
> the unit tests. It is solved by calling:
> org.openstreetmap.josm.JOSMFixture.createUnitTestFixture().init();
>
> Though keep in mind, that this is part of the testing code, so it's
> located here:
> http://josm.openstreetmap.de/browser/josm/trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
>
> This should give you a hint, how to initiate "headless" mode.
>
> Cheers,
> Wiktor
>
> 2015-12-12 18:52 GMT+01:00 Holger Mappt:
>> My idea was to write a small program that calls TMSLayer.getCache() to get
>> the TMS cache. But to do that I need to initialize JOSM (preferences, TMS
>> layer, and tile cache). How would I do that? Is there something like a
>> headless mode where I can hook into? I tried to call some of the
>> initialization methods, but there are too many dependencies and I would need
>> a running JOSM to make that work.



More information about the josm-dev mailing list