#!/bin/bash
# This file is part of the PyOWS-WMS-Server package (= program).
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
# author(s): Sebastian Holler
#
# Copyright (c)2008 by Sebastian Holler
# for document references, used in this source code: see
# use: listing all vector and raster layers from the current location
# run this script in GRASS environment!!
# output format:
# proj4string#abstract#WGS84BBox
# print projection information in PROJ.4 format (see: $ g.proj --help):
g.proj -j
#HACK: the output above doesn't print datum information:
if [ ! "$(g.proj -d | grep 'GRASS datum code:' | awk '{print $4}')" == "" ]; then
echo +datum=$(g.proj -d | grep "GRASS datum code:" | awk '{print $4}')
fi
echo -n "#"
# abstract:
if [ -f $LOCATION/PERMANENT/MYNAME ]; then
# only first line; '#' not allowed, because it is used as separator
cat $LOCATION/PERMANENT/MYNAME | head -n 1 | sed 's/#//g'
fi
echo -n "#"
# WGS84BBox:
# set default location and print its bounding box in lat/lon on WGS84
# note: Please make sure, that your current "default region" covers all
# maps in your location: You can use "g.region -s" to reset it.
if ! PYWMS_WGS84=$(g.region -dbg 2>/dev/null); then
# transformation to WGS84 not possible (missing parameters):
echo "fail"
else
echo "$PYWMS_WGS84" | head -n 4
fi