Osmosis/Quick Install (Windows)

From OpenStreetMap Wiki
Jump to: navigation, search

Osmosis windows installation is quite straightforward and similar in many ways to Osmosis/Installation on other operating systems.

Installing

You need Java (specifically Java Runtime Environment) to be able to run osmosis. If you don't have it (check here if you're not sure), you can download JRE from java.com/en/download. After the download completes, double-click the downloaded installer and follow the instructions.

Download the latest osmosis runtime zip file from http://bretth.dev.openstreetmap.org/osmosis-build/osmosis-latest.zip (DOWNLOAD) . You'll need to put it where you can unzip/edit it (eg your desktop)

Unzip the downloaded file. You don't need the outer directory (osmosis-latest), and you may find it simpler to remove the version number from the next-level directory. Put the directory somewhere appropriate (eg C:\Program Files (x86)\)

You should now check your osmosis.bat file in the \bin directory. See #As of October 2015, osmosis.bat is broken below.

Finally, you need to get access to Osmosis via the Command Line. One way of doing this is described at http://learnosm.org/en/osm-data/osmosis/, another is the following:

Create a text file with a .BAT extension (probably somewhere in your user space) containing something like this:

"C:\Program Files (x86)\osmosis\bin\osmosis.bat"

(the quotes are necessary because there are spaces in the directory name; the .bat isn't required, it's just there for clarity)

You can run this by double-clicking on the file, but you may well find that the window closes before you can see what's happened. In which case, create a shortcut to the file, open its Properties, and on the Shortcut tab insert cmd /k at the beginning of the Target. This runs it in a window that stays open.

The output should look very similar to this:

Apr 23, 2012 3:20:31 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.40.1
Apr 23, 2012 3:20:31 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Apr 23, 2012 3:20:31 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Apr 23, 2012 3:20:31 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
Apr 23, 2012 3:20:31 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline complete.
Apr 23, 2012 3:20:31 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Total execution time: 387 milliseconds.

You're set. Osmosis works. Head on over to Osmosis#Example_Usage for some basic usage examples. The full reference documentation is here.

Troubleshooting

Osmosis may well need to be told where to find java.

  • Find the java application (exe file) - it's probably in C:\Program Files (x86)\Java\jre6\bin\.
  • Edit C:\Program Files (x86)\osmosis\bin\osmosis.bat
  • Find the line about 3/4 of the way down that sets JAVACMD and change it to:
IF "%JAVACMD%"=="" set JAVACMD="C:\Program Files (x86)\Java\jre7\bin\java" 
  • You may also have to change the line near the end that sets EXEC and put double quotes before and after %JAVACMD%


IMPORTANT:

As of October 2015, osmosis.bat is broken

You'll receive the following error message, when trying to start osmosis.bat

SEVERE: Could not find or load main class org.codehaus.classworlds.Launcher

To fix the issue, change the second to last line from

set PLEXUS_CP=%MYAPP_HOME%\lib\default\plexus-classworlds-2.4.jar

to

set PLEXUS_CP=%MYAPP_HOME%\lib\default\plexus-classworlds-2.5.2.jar


If this doesn't fix the problem, it might also be necessary to change the last line from

SET EXEC="%JAVACMD%" %JAVACMD_OPTIONS% -cp "%PLEXUS_CP%" -Dapp.home="%MYAPP_HOME%" -Dclassworlds.conf="%MYAPP_HOME%\config\plexus.conf" %MAINCLASS%  %OSMOSIS_OPTIONS% %*

to

SET EXEC="%JAVACMD%" -cp "%PLEXUS_CP%" -Dapp.home="%MYAPP_HOME%" -Dclassworlds.conf="%MYAPP_HOME%\config\plexus.conf" %MAINCLASS%  %OSMOSIS_OPTIONS% %*

see http://forum.openstreetmap.org/viewtopic.php?id=32287 and https://help.openstreetmap.org/questions/44777/could-not-find-or-load-main-class-orgcodehausclassworldslauncher

Help

Not working? Search for a solution to your problem. You can also Contact the community in various ways to ask for help. If you choose to ask a new question on http://help.openstreetmap.org be sure to search first, and be sure to mention that you are using Osmosis on Windows.