[osmosis-dev] Android?
Adrià Ribatallada Torelló
achtungwolf at gmail.com
Thu Nov 8 20:37:36 GMT 2012
Thank you Brett, I'v followed your advice and tried to remove the JPF from
a local clone of the osmosis source, and adapted the plugin I need to use
the osmosis-plugins.conf.
And all compiles good and fine, and if I execute the command I need using
the bin/osmosis script in my machine all goes fine.
But in the Android device I need to do it from the code (or so I think),
calling Osmosis.run(args) or Osmosis.main() I presume, and there is where
it fails now...
That's the code I'm trying to run:
File pbfFile = new
File(Environment.getExternalStorageDirectory()+"/download/"+"in.osm.pbf");
File outFile = new
File(Environment.getExternalStorageDirectory()+"/download/"+"out.map");
Osmosis.main(new String[] {
"--read-pbf file="+pbfFile,
"--mapfile-writer file="+outFile
});
That's my pretty error:
11-08 19:53:16.148: W/System.err(3090): 2012 11 8 19:53:16
org.openstreetmap.osmosis.core.Osmosis run
11-08 19:53:16.148: W/System.err(3090): INFO: Osmosis Version
0.40.1-3-gbd9521a-dirty
11-08 19:53:16.638: W/System.err(3090): 2012 11 8 19:53:16
java.io.BufferedReader <init>
11-08 19:53:16.638: W/System.err(3090): INFO: Default buffer size used in
BufferedReader constructor. It would be better to be explicit if an 8k-char
buffer is required.
11-08 19:53:16.718: W/System.err(3090): 2012 11 8 19:53:16
org.openstreetmap.osmosis.core.Osmosis run
11-08 19:53:16.718: W/System.err(3090): INFO: Preparing pipeline.
11-08 19:53:16.758: W/System.err(3090): 2012 11 8 19:53:16
org.openstreetmap.osmosis.core.Osmosis main
11-08 19:53:16.758: W/System.err(3090): SEVERE: Execution aborted.
11-08 19:53:16.758: W/System.err(3090): Throwable occurred:
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Task type read-pbf
file=/mnt/sdcard/download/in.osm.pbf doesn't exist.
I assume that is thrown because the envirenoment it's not well configured,
but I don't know how to "do the same" that does the script from my program
code :P
I'v tried to run the classworlds.Launcher, but I didn't suceed there...
Can some of you help me understand what needs to be done "programatically"
to setup the environment?
Thanks again.
2012/11/7 Brett Henderson <brett at bretth.com>
> Hi Adrià,
>
> On 7 November 2012 03:41, Adrià Ribatallada Torelló <achtungwolf at gmail.com
> > wrote:
>
>> Hi there!
>>
>> I was trying to use the osmosis tool in an android device, and
>> after including all the required libraries to an android project and make
>> it compile and install in the device I'v encountered some "runtime"
>> obstacles that made me consider that the best approach might be to adapt
>> the osmosis source code, adapting it to use the android libraries.
>>
>> (the most severe "obstacle" is a "No validating SAXParser implementation
>> available" while trying to read the file plugin.xml. Is the same error
>> explained here with more detail by this other guy:
>> http://stackoverflow.com/questions/10222230/trying-to-use-osmosis-in-android-environment-duplicate-file-error-with-jar-file/13251374#13251374
>> ).
>>
>
> I'm not sure if this helps, but the plugin.xml loading code is used by JPF
> (Java Plugin Framework) support. JPF provides one way of packaging Osmosis
> plugins, but is rarely used. The majority of plugins use a simpler
> mechanism involving a properties file called osmosis-plugin.conf bundled in
> each plugin jar file. If you don't need JPF you could remove the JPF code
> from Osmosis completely and eliminate the error you're receiving.
>
> Brett
>
>
--
_____ _______ ________
/ ಠ_ಠ | | ಠ_ಠ \ |__ ಠ_ಠ__|
/ / | | | / | |
/ __ | | _ \ | | _
/__/ |__| |__| \ _\ |__| |_|
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/osmosis-dev/attachments/20121108/74eb52f1/attachment.html>
More information about the osmosis-dev
mailing list