source: subversion/applications/rendering/osmarender6/osmarender @ 9059

Last change on this file since 9059 was 7044, checked in by frederik, 12 years ago

revert accidental modification

  • Property svn:executable set to *
File size: 2.7 KB
Line 
1#!/bin/bash
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#  osmarender6 directory. In bash this works like this:
11#
12#  > export OSMARENDER=~/osm/osmarender6
13#
14#=============================================================================
15#
16#  Copyright (C) 2006-2007  Jochen Topf
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
47OSMARENDER_RULEFILE="$OSMARENDER/osm-map-features-z17.xml"
48
49while getopts r:t: opt; do
50    case "$opt" in
51        r)  rulefile="$OPTARG";;
52        t)  title="$OPTARG";;
53    esac
54done
55shift `expr $OPTIND - 1`
56
57osmfile=$1; shift
58mapfile=$1; shift
59
60if [ "$osmfile" = "" ]; then
61    echo >&2 "Too few parameters"
62    usage >&2
63    exit 1
64fi
65
66if [ "$1" != "" ]; then
67    echo >&2 "Too many parameters"
68    usage >&2
69    exit 1
70fi
71
72# if there is no rulefile given we use the default
73if [ "$rulefile" = "" ]; then
74    echo >&2 "Using standard rule file: $OSMARENDER_RULEFILE"
75    rulefile=$OSMARENDER_RULEFILE
76fi
77
78# if there is no mapfile given we use osm data file name with changed suffix
79if [ "$mapfile" = "" ]; then
80    mapfile="${osmfile%.osm}.svg"
81fi
82
83case "$osmfile" in
84    /*) ;;
85    *) osmfile=`pwd`"/$osmfile";;
86esac
87
88if [ "$title" == '' ]; then
89    $OSMARENDER/xsltrans --stringparam osmfile=$osmfile $rulefile $OSMARENDER/osmarender.xsl > $mapfile 
90else
91    $OSMARENDER/xsltrans --stringparam osmfile=$osmfile --stringparam title="$title" $rulefile $OSMARENDER/osmarender.xsl > $mapfile 
92fi
93
Note: See TracBrowser for help on using the repository browser.