convert pbf file to map file

4,114 views
Skip to first unread message

sans

unread,
Jun 6, 2012, 7:49:16 PM6/6/12
to mapsforge-dev
Hi there,

I converted the osm file to pbf file by using osmconverter, then
installed the mapsforge-map-wirter-0.3.0.jar onto the directory
osmosis-0.40.1\plugins, also I copied the pbf file onto
osmosis-0.40.1\bin, then I write the command through command line:
bin>, The error message i got from the command window is: mapfile-
wirter does not exist, the following are short version of the error
message.

Anybody can help me?


Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Users\sp76\Desktop\ConvertorMap\osmosis-0.40.1\bin>osmosis --rb
map_01.pbf --
mapfile-writer file="auckland.map"
...
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Task type
mapfile-writer
doesn't exist.


Thanks,

Karsten Groll

unread,
Jun 7, 2012, 9:01:00 AM6/7/12
to mapsfo...@googlegroups.com
Hello,

you have to copy the jar file to
%APPDATA%/Openstreetmap/Osmosis/Plugins in order to add it to Osmosis'
plugins.

Regards,

Karsten

2012/6/7 sans <shanho...@gmail.com>:

casey p

unread,
Jun 7, 2012, 7:18:24 PM6/7/12
to mapsfo...@googlegroups.com
Hi Karsten,

I made it work yesterday. What you said is correct. But I don't understand why we need to
copy the plugin onto %APPDATA%/Openstreetmap/Osmosis/Plugins?



 By the way, the other problem is the file what I got
is XML based data, so the command was not quite correct.


I always be thankful to mapsforge-dev for supporting me.


Cheers,


Sans

Karsten Groll

unread,
Jun 8, 2012, 10:17:42 AM6/8/12
to mapsfo...@googlegroups.com
The given folder is the one where Osmosis looks for third-party tasks
(= addons that read, transform and / or write OSM data). The
osmosis/lib folder contains libraries required by those tasks.

According to your example you were using a .pbf file as an input, so
"--rb" is the correct target for reading data. If you want to read
data from an XML source you have to use the "--rx" (short form form
"--read-xml") target.

Regards,

Karsten

2012/6/8 casey p <shanho...@gmail.com>:

Steven Low

unread,
Sep 20, 2012, 3:05:07 PM9/20/12
to mapsfo...@googlegroups.com, karste...@googlemail.com
Hi Karsten,

I have tried to put the jar file into \AppData\Openstreetmap\Osmosis\Plugins, but I still get the same error when running "bin\osmosis --rx file=map.osm --mw file=temp\custom.map".

Sep 21, 2012 2:59:33 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.41
Sep 21, 2012 2:59:33 AM org.java.plugin.registry.xml.ManifestParser <init>
INFO: got SAX parser factory - org.apache.xerces.jaxp.SAXParserFactoryImpl@53bbf
a
Sep 21, 2012 2:59:33 AM org.java.plugin.registry.xml.PluginRegistryImpl configur
e
INFO: configured, stopOnError=false, isValidating=true
Sep 21, 2012 2:59:33 AM org.java.plugin.registry.xml.PluginRegistryImpl register

INFO: plug-in and fragment descriptors registered - 1
Sep 21, 2012 2:59:33 AM org.java.plugin.standard.StandardPluginManager activateP
lugin
INFO: plug-in started - org.openstreetmap.osm...@0.41.0
Sep 21, 2012 2:59:33 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Sep 21, 2012 2:59:33 AM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Task type mw doesn't exi
st.
        at org.openstreetmap.osmosis.core.pipeline.common.TaskManagerFactoryRegi
ster.getInstance(TaskManagerFactoryRegister.java:60)
        at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.buildTasks(Pi
peline.java:50)

By the way, I also have tried to use Osmosis parameter ‘-plugin org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader’ to load the plugin, while I get error below.

Sep 21, 2012 3:01:52 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.41
Sep 21, 2012 3:01:52 AM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: Unable to load plugin cl
ass (org.mapsforge.map.writer.osmosis.MapFileWriterPluginLoader).
        at org.openstreetmap.osmosis.core.TaskRegistrar.loadPluginClass(TaskRegi
strar.java:334)
        at org.openstreetmap.osmosis.core.TaskRegistrar.loadPlugin(TaskRegistrar
.java:313)
        at org.openstreetmap.osmosis.core.TaskRegistrar.initialize(TaskRegistrar
.java:84)


Can anyone please advice?


Regards,
Steven

Ludwig

unread,
Sep 20, 2012, 7:47:37 PM9/20/12
to mapsfo...@googlegroups.com
it looks to me that the plugin is not in a location where osmosis can find it. 

http://code.google.com/p/mapsforge/wiki/GettingStartedMapWriter has a couple of examples of where to put the file, depending on your operating system.

HTH

Steven Low

unread,
Sep 20, 2012, 11:46:56 PM9/20/12
to mapsfo...@googlegroups.com
Thanks Ludwig,

It work successfully after I move the jar to 
C:\Users\Steven\.openstreetmap\osmosis\plugins
The plugin seem does not able to locate from folder
C:\Users\Steven\AppData\Openstreetmap\Osmosis\Plugins as suggested for windows (I am using windows 7).
Anyway, I able to generate the map file now.
Additional note, it will have some error while you using Osmosis 0.41, it work nicely with Osmosis 0.40.1.


Regards,
Steven.

On Friday, 21 September 2012 07:47:38 UTC+8, Ludwig wrote:
it looks to me that the plugin is not in a location where osmosis can find it. 

http://code.google.com/p/mapsforge/wiki/GettingStartedMapWriter has a couple of examples of where to put the file, depending on your operating system.

HTH
On 21 September 2012 03:05, Steven Low <low.ka...@gmail.com> wrote:
Hi Karsten,

I have tried to put the jar file into \AppData\Openstreetmap\Osmosis\Plugins, but I still get the same error when running "bin\osmosis --rx file=map.osm --mw file=temp\custom.map".

Sep 21, 2012 2:59:33 AM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.41
Sep 21, 2012 2:59:33 AM org.java.plugin.registry.xml.ManifestParser <init>
INFO: got SAX parser factory - org.apache.xerces.jaxp.SAXParserFactoryImpl@53bbf
a
Sep 21, 2012 2:59:33 AM org.java.plugin.registry.xml.PluginRegistryImpl configur
e
INFO: configured, stopOnError=false, isValidating=true
Sep 21, 2012 2:59:33 AM org.java.plugin.registry.xml.PluginRegistryImpl register

INFO: plug-in and fragment descriptors registered - 1
Sep 21, 2012 2:59:33 AM org.java.plugin.standard.StandardPluginManager activateP
lugin
INFO: plug-in started - org.openstreetmap.osmosis.core.plu...@0.41.0

Ludwig

unread,
Sep 21, 2012, 12:25:06 AM9/21/12
to mapsfo...@googlegroups.com
Could you post the errors with osmosis 0.4.1?

Steven Low

unread,
Sep 21, 2012, 12:40:35 AM9/21/12
to mapsfo...@googlegroups.com
Here you go,

Sep 21, 2012 12:37:41 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.41
Sep 21, 2012 12:37:41 PM org.java.plugin.registry.xml.ManifestParser <init>
INFO: got SAX parser factory - org.apache.xerces.jaxp.SAXParserFactoryImpl@a2ba05
Sep 21, 2012 12:37:41 PM org.java.plugin.registry.xml.PluginRegistryImpl configure
INFO: configured, stopOnError=false, isValidating=true
Sep 21, 2012 12:37:41 PM org.java.plugin.registry.xml.PluginRegistryImpl register
INFO: plug-in and fragment descriptors registered - 1
Sep 21, 2012 12:37:41 PM org.java.plugin.standard.StandardPluginManager activatePlugin
INFO: plug-in started - org.openstreetmap.osm...@0.41.0
Sep 21, 2012 12:37:41 PM org.java.plugin.registry.xml.PluginRegistryImpl register
INFO: plug-in and fragment descriptors registered - 1
Sep 21, 2012 12:37:41 PM org.java.plugin.standard.StandardPluginManager activatePlugin
INFO: plug-in started - org.mapsforge.ma...@0.3.0
Sep 21, 2012 12:37:41 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Sep 21, 2012 12:37:41 PM org.mapsforge.map.writer.osmosis.MapFileWriterTask <init>
INFO: mapfile-writer version: mapsforge-map-writer-0.3.0
Sep 21, 2012 12:37:41 PM org.mapsforge.map.writer.osmosis.MapFileWriterTask <init>
INFO: mapfile format specification version: 3
Sep 21, 2012 12:37:41 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Sep 21, 2012 12:37:41 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
Sep 21, 2012 12:37:41 PM org.openstreetmap.osmosis.core.pipeline.common.ActiveTa
skManager waitForCompletion
SEVERE: Thread for task 1-rx failed
java.lang.AbstractMethodError: org.mapsforge.map.writer.osmosis.MapFileWriterTask.initialize(Ljava/util/Map;)V
        at org.openstreetmap.osmosis.xml.v0_6.XmlReader.run(XmlReader.java:95)
        at java.lang.Thread.run(Unknown Source)

Sep 21, 2012 12:37:41 PM org.openstreetmap.osmosis.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException: One or more tasks failed.
        at org.openstreetmap.osmosis.core.pipeline.common.Pipeline.waitForCompletion(Pipeline.java:146)
        at org.openstreetmap.osmosis.core.Osmosis.run(Osmosis.java:92)
        at org.openstreetmap.osmosis.core.Osmosis.main(Osmosis.java:37)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
        at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
INFO: plug-in started - org.openstreetmap.osmosis.core.plugin.Core@0.41.0

Ludwig

unread,
Sep 21, 2012, 12:50:30 AM9/21/12
to mapsfo...@googlegroups.com
That looks like an osmosis build or installation error to me. What actually fails is the reading of the OSM input file which has nothing to do with mapsforge. 

You could test this by running something like 

bin\osmosis --rx file=map.osm --wb file=dummy.pbf

which just writes out the input in a different format and does not involve mapsforge at all.

Steven Low

unread,
Sep 21, 2012, 1:02:59 AM9/21/12
to mapsfo...@googlegroups.com
Just tested, it doesn't have any issue with export to pbf

Sep 21, 2012 1:01:33 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.41
Sep 21, 2012 1:01:33 PM org.java.plugin.registry.xml.ManifestParser <init>
INFO: got SAX parser factory - org.apache.xerces.jaxp.SAXParserFactoryImpl@a2ba05
Sep 21, 2012 1:01:33 PM org.java.plugin.registry.xml.PluginRegistryImpl configure
INFO: configured, stopOnError=false, isValidating=true
Sep 21, 2012 1:01:33 PM org.java.plugin.registry.xml.PluginRegistryImpl register

INFO: plug-in and fragment descriptors registered - 1
Sep 21, 2012 1:01:33 PM org.java.plugin.standard.StandardPluginManager activatePlugin
INFO: plug-in started - org.openstreetmap.osm...@0.41.0
Sep 21, 2012 1:01:33 PM org.java.plugin.registry.xml.PluginRegistryImpl register

INFO: plug-in and fragment descriptors registered - 1
Sep 21, 2012 1:01:33 PM org.java.plugin.standard.StandardPluginManager activatePlugin
INFO: plug-in started - org.mapsforge.ma...@0.3.0
Sep 21, 2012 1:01:33 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Sep 21, 2012 1:01:33 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Sep 21, 2012 1:01:33 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
Sep 21, 2012 1:01:33 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline complete.
Sep 21, 2012 1:01:33 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Total execution time: 598 milliseconds.

On Friday, 21 September 2012 12:50:35 UTC+8, Ludwig wrote:
That looks like an osmosis build or installation error to me. What actually fails is the reading of the OSM input file which has nothing to do with mapsforge. 

You could test this by running something like 

bin\osmosis --rx file=map.osm --wb file=dummy.pbf

which just writes out the input in a different format and does not involve mapsforge at all.


On 21 September 2012 12:40, Steven Low <low.ka...@gmail.com> wrote:
Here you go,

Sep 21, 2012 12:37:41 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.41
Sep 21, 2012 12:37:41 PM org.java.plugin.registry.xml.ManifestParser <init>
INFO: got SAX parser factory - org.apache.xerces.jaxp.SAXParserFactoryImpl@a2ba05
Sep 21, 2012 12:37:41 PM org.java.plugin.registry.xml.PluginRegistryImpl configure
INFO: configured, stopOnError=false, isValidating=true
Sep 21, 2012 12:37:41 PM org.java.plugin.registry.xml.PluginRegistryImpl register
INFO: plug-in and fragment descriptors registered - 1
Sep 21, 2012 12:37:41 PM org.java.plugin.standard.StandardPluginManager activatePlugin
INFO: plug-in started - org.openstreetmap.osmosis.core.plu...@0.41.0
Sep 21, 2012 12:37:41 PM org.java.plugin.registry.xml.PluginRegistryImpl register
INFO: plug-in and fragment descriptors registered - 1
Sep 21, 2012 12:37:41 PM org.java.plugin.standard.StandardPluginManager activatePlugin
INFO: plug-in started - org.mapsforge.map.mapfile-wri...@0.3.0

Ludwig

unread,
Sep 21, 2012, 1:47:50 AM9/21/12
to mapsfo...@googlegroups.com
Sorry, just rereading the original error message and it fails when initializing the map file writer. So, yes that is an issue. 

UlrichK

unread,
Sep 21, 2012, 6:06:13 PM9/21/12
to mapsfo...@googlegroups.com
As a source level fix it is sufficient to simply add the "initialize(Map m)" method to MapFileWriterTask.

Jürgen Broß

unread,
Sep 25, 2012, 4:44:17 PM9/25/12
to mapsfo...@googlegroups.com
The described error stems from a change of the core osmosis API. See my
recent comment in our issue tracker:

http://code.google.com/p/mapsforge/issues/detail?id=354

Regards,
Jürgen

On 22.09.2012 00:06, UlrichK wrote:
> As a source level fix it is sufficient to simply add the "initialize(Map
> m)" method to MapFileWriterTask.
>
>
>
> Am Freitag, 21. September 2012 07:47:51 UTC+2 schrieb Ludwig:
>>
>> Sorry, just rereading the original error message and it fails when
>> initializing the map file writer. So, yes that is an issue.
>>
>> On 21 September 2012 13:02, Steven Low <low.ka...@gmail.com <javascript:>>wrote:
>>
>>> Just tested, it doesn't have any issue with export to pbf
>>>
>>
>>


--


Jürgen Broß
Institute of Computer Science
Databases and Information Systems
Freie Universität Berlin
Takustr. 9
D-14195 Berlin, Germany
phone: +49 30 838-75108
email: juerge...@fu-berlin.de

signature.asc
Reply all
Reply to author
Forward
0 new messages