Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Made documentation clearer for Windows and made
batch file less likely to fail
  • Loading branch information
SomeoneElseOSM committed Sep 11, 2015
1 parent 7b6e7ba commit c2a8a69
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 53 deletions.
54 changes: 27 additions & 27 deletions package/bin/osmosis.bat
@@ -1,29 +1,29 @@
rem @ECHO OFF

REM This is an equivalent Windows batch file to complement the unix shell script
REM Corresponding lines from the shell script are printed before the matching batch file commands

REM # Config files can define several variables used throughout this script.
REM # JAVACMD - The java command to launch osmosis.
REM # JAVACMD_OPTIONS - The options to append to the java command, typically used to modify jvm settings such as max memory.
REM # OSMOSIS_OPTIONS - The options to apply to all osmosis invocations, typically used to add plugins or make quiet operation the default.

REM if [ -f /etc/osmosis ] ; then
REM . /etc/osmosis
REM fi
IF EXIST "%ALLUSERSPROFILE%\osmosis.bat" CALL "%ALLUSERSPROFILE%\osmosis.bat"

REM if [ -f "$HOME/.osmosis" ] ; then
REM . "$HOME/.osmosis"
REM fi
IF EXIST "%USERPROFILE%\osmosis.bat" CALL "%USERPROFILE%\osmosis.bat"


REM if [ -z "$JAVACMD" ] ; then
REM # No JAVACMD provided in osmosis config files, therefore default to java
REM JAVACMD=java
REM fi
IF "%JAVACMD%"=="" set JAVACMD=java
@ECHO OFF

rem ------------------------------------------------------------------------------
rem This was developed from the previous Windows "osmosis.bat" which in turn was
rem a copy of the Unix version.
rem
rem The main changes are to add comments and remove things that can break, so
rem no execution of random batch files from unexpected folders such as
rem "C:\ProgramData"
rem ------------------------------------------------------------------------------

rem ------------------------------------------------------------------------------
rem Use "java" from the path. This is what almost every other Java application
rem will do; anything else will just confuse users.
rem ------------------------------------------------------------------------------
set JAVACMD=java

rem ------------------------------------------------------------------------------
rem The net result of the jiggerypokery below is so that a command similar to this
rem eventually gets executed:
rem
rem "java" -cp "C:\Temp\osmosis-latest\lib\default\plexus-classworlds-2.5.2.jar" -Dapp.home="C:\Temp\osmosis-latest" -Dclassworlds.conf="C:\Temp\osmosis-latest\config\plexus.conf" org.codehaus.classworlds.Launcher
rem
rem with the full path used for the "classworlds" launcher, "app_home" and the
rem classworlds.conf file.
rem ------------------------------------------------------------------------------

REM Set "SAVEDIR" to the current directory
set SAVEDIR=%CD%
Expand All @@ -36,6 +36,6 @@ cd /D %SAVEDIR%

set MAINCLASS=org.codehaus.classworlds.Launcher
set PLEXUS_CP=%MYAPP_HOME%\lib\default\plexus-classworlds-2.5.2.jar
SET EXEC="%JAVACMD%" %JAVACMD_OPTIONS% -cp "%PLEXUS_CP%" -Dapp.home="%MYAPP_HOME%" -Dclassworlds.conf="%MYAPP_HOME%\config\plexus.conf" %MAINCLASS% %OSMOSIS_OPTIONS% %*
SET EXEC="%JAVACMD%" -cp "%PLEXUS_CP%" -Dapp.home="%MYAPP_HOME%" -Dclassworlds.conf="%MYAPP_HOME%\config\plexus.conf" %MAINCLASS% %OSMOSIS_OPTIONS% %*

%EXEC%
60 changes: 34 additions & 26 deletions package/readme.txt
@@ -1,42 +1,50 @@
INSTALLATION
Unzip the distribution in the location of your choice.
On unix/linux systems, make the bin/osmosis script executable (ie. chmod u+x osmosis).
If desired, create a symbolic link to the osmosis script somewhere on your path (eg. ln -s appdir/bin/osmosis ~/bin/osmosis).

CONFIGURATION
Common command line options can be specified in configuration files.
Firstly, if you're using a Linux system, you probably don't want to bother - just use the version of osmosis
that was packaged with your distribution and you'll probably be fine (osmosis really doesn't change very
often).

On Linux, the file can reside in the following locations with later files overriding earlier files:
/etc/osmosis
$HOME/.osmosis
To install, unzip the distribution in the location of your choice.

On Windows, the file can reside in the following locations with later files overriding earlier files:
%ALLUSERSPROFILE%\osmosis.bat
%USERPROFILE%\osmosis.bat
On Unix/Linux systems, make the bin/osmosis script executable (ie. chmod u+x osmosis).
If desired, create a symbolic link to the osmosis script somewhere on your path (eg. ln -s appdir/bin/osmosis ~/bin/osmosis).

The following variables can be defined in these files:
JAVACMD - The java command to be invoked. Default is "java".
JAVACMD_OPTIONS - The java jvm options to apply (eg. -Xmx512M).
OSMOSIS_OPTIONS - The osmosis options to apply (eg. -q or -plugin MyPluginLoaderClass).
On Windows, install wherever you like (but preferably not somewhere that Windows will try and control
access to such as the root directory or "Program Files").

COMPILATION
To perform a complete osmosis rebuild, the following command may be run from the osmosis root directory.
RUNNING ON WINDOWS
Open a command prompt and change directory to the the "bin" folder below the "osmosis-latest"
that the unzipping will have created.

ant all
Just type "osmosis" and press return, and you should see something like:

The "all" ant target performs all steps including creation of new distribution files, checkstyle analysis and unit tests.
Sep 11, 2015 4:14:25 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Osmosis Version 0.44.1
Sep 11, 2015 4:14:25 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Preparing pipeline.
Sep 11, 2015 4:14:25 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Launching pipeline execution.
Sep 11, 2015 4:14:25 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline executing, waiting for completion.
Sep 11, 2015 4:14:25 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Pipeline complete.
Sep 11, 2015 4:14:25 PM org.openstreetmap.osmosis.core.Osmosis run
INFO: Total execution time: 552 milliseconds.

Sometimes old files can be left hanging around causing problems. It may be necessary to run the following command
to clean up any old files.
As an example, to use osmosis on Windows to cut a piece out of a PBF that
you have already downloaded, do something like this:

ant clean
osmosis --read-pbf c:\temp\osm\great-britain.osm.pbf --bounding-box left=-4.44 bottom=51.46 right=-0.78 top=54.04 --write-pbf c:\temp\osm\cut_example.pbf

If you wish to rebuild all artefacts without running unit tests, the following command may be used.
(specifying full paths for the input and output files helps avoid errors -
you know exactly where the files are)

ant publish

HELP
Osmosis documentation is available at:
http://wiki.openstreetmap.org/index.php/Osmosis
Some Osmosis documentation is available at:
http://wiki.openstreetmap.org/wiki/Osmosis

There are lots of examples there (though if you're on Windows you'll need to translate the command line
examples from Unix/Linux)

Please ask any questions, report any issues, or suggest enhancements using the Open Street Map talk or development mailing lists.

0 comments on commit c2a8a69

Please sign in to comment.