source: subversion/utils/osmarender4/osmarender @ 1911

Last change on this file since 1911 was 1885, checked in by jochen, 13 years ago

Deleted some unneeded stuff and added some comments.
osmarender shell wrapper now looks in current dir if OSMARENDER env var not set

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#!/bin/sh
2#=============================================================================
3#
4#  osmarender [-r rulefile] [-t title] <osmfile> [<svgfile>]
5#
6#  This is a wrapper around the osmarender XSL transformation. If you don't
7#  specify a <svgfile> it will use <osmfile> with .svg suffix instead.
8#
9#  To use this set the environment variable OSMARENDER to the path to your
10#  osmarender4 directory. In bash this works like this:
11#
12#  > export OSMARENDER=~/osm/osmarender4
13#
14#=============================================================================
15#
16#  Copyright (C) 2006-2007  OpenStreetMap Foundation
17#
18#  This program is free software; you can redistribute it and/or modify
19#  it under the terms of the GNU General Public License as published by
20#  the Free Software Foundation; either version 2 of the License, or
21#  (at your option) any later version.
22#
23#  This program is distributed in the hope that it will be useful,
24#  but WITHOUT ANY WARRANTY; without even the implied warranty of
25#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26#  GNU General Public License for more details.
27#
28#  You should have received a copy of the GNU General Public License
29#  along with this program; if not, write to the Free Software
30#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
31#
32#=============================================================================
33
34prgname=`basename $0`
35
36function usage() {
37    echo "Usage: $prgname [options] <osmfile> [<svgfile>]"
38    echo "Options: -r   Set rulefile"
39    echo "         -t   Set title for map"
40
41}
42
43if [ "$OSMARENDER" = "" ]; then
44    OSMARENDER="."
45fi
46
47while getopts r:t: opt; do
48    case "$opt" in
49        r)  rulefile="$OPTARG";;
50        t)  title="$OPTARG";;
51    esac
52done
53shift `expr $OPTIND - 1`
54
55osmfile=$1; shift
56mapfile=$1; shift
57
58if [ "$osmfile" = "" ]; then
59    echo >&2 "Too few parameters"
60    usage >&2
61    exit 1
62fi
63
64if [ "$1" != "" ]; then
65    echo >&2 "Too many parameters"
66    usage >&2
67    exit 1
68fi
69
70# if there is no rulefile given we use standard.xml
71if [ "$rulefile" = "" ]; then
72    echo >&2 "Using standard rule file: standard.xml"
73    rulefile="$OSMARENDER/rules/standard.xml"
74fi
75
76# if there is no mapfile given we use osm data file name with changed suffix
77if [ "$mapfile" = "" ]; then
78    mapfile="${osmfile%.osm}.svg"
79fi
80
81case "$osmfile" in
82    /*) echo slash;;
83    *) osmfile=`pwd`"/$osmfile";;
84esac
85
86if [ "$title" == '' ]; then
87    $OSMARENDER/xsltrans --stringparam osmfile=$osmfile $rulefile $OSMARENDER/osmarender.xsl > $mapfile
88else
89    $OSMARENDER/xsltrans --stringparam osmfile=$osmfile --stringparam title="$title" $rulefile $OSMARENDER/osmarender.xsl > $mapfile
90fi
91
Note: See TracBrowser for help on using the repository browser.