<commit_before>#!/bin/sh
#
# Install MapProxy server
#
# Created by <NAME> <<EMAIL>>
# Copyright (c) 2010-2016 The Open Source Geospatial Foundation.
# Licensed under the GNU LGPL version >= 2.1.

./diskspace_probe.sh "`basename $0`" begin
BUILD_DIR=`pwd`
####

if [ -z "$USER_NAME" ] ; then
   USER_NAME="user"
fi
USER_HOME="/home/$USER_NAME"

BIN="/usr/local/bin"
TMP="/tmp/build_mapproxy"
MAPPROXY_VERSION="1.8.2"
MAPPROXY_DOCS_FILE="MapProxy-docs-1.8.0.tar.gz"
MAPPROXY_DOCS_URL="http://mapproxy.org/static/rel/$MAPPROXY_DOCS_FILE"
MAPPROXY_DIR="/usr/local/share/mapproxy"

apt-get install --yes python-mapproxy

mkdir -p "$TMP"
cd "$TMP"

echo "Downloading: $MAPPROXY_DOCS_URL"
wget --timestamping --continue --progress=dot:mega "$MAPPROXY_DOCS_URL"
if [ $? -ne 0 ] ; then
   echo "ERROR: download failed"
   exit 1
fi

mkdir -p $MAPPROXY_DIR/docs
echo "Extracting docs: $MAPPROXY_DOCS_FILE"
tar -xz --strip-components 1 -C "$MAPPROXY_DIR"/docs -f "$MAPPROXY_DOCS_FILE"
if [ $? -ne 0 ] ; then
   echo "ERROR: docs install failed"
   exit 1
fi
ln -sf "$MAPPROXY_DIR/docs" /var/www/html/mapproxy

echo "Creating Scripts/Links"
# Create startup script for MapProxy Server
cat << EOF > "$BIN/mapproxy_start.sh"
#!/bin/sh
mapproxy-util serve-develop -b 0.0.0.0:8011 /usr/local/share/mapproxy/mapproxy.yaml
EOF

chmod 755 $BIN/mapproxy_start.sh


## Create Desktop Shortcut for starting MapProxy Server in shell
cat << EOF > /usr/share/applications/mapproxy-start.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Start MapProxy
Comment=MapProxy for LiveDVD WMS services
Categories=Application;Geography;Geoscience;Education;
Exec=lxterminal -e mapproxy_start.sh
Icon=gnome-globe
Terminal=false
StartupNotify=false
EOF

cp -a /usr/share/applications/mapproxy-start.desktop "$USER_HOME/Desktop/"
chown -R $USER_NAME:$USER_NAME "$USER_HOME/Desktop/mapproxy-start.desktop"

# Create Desktop Shortcut for Basic Intro page and Demo
cat << EOF > /usr/share/applications/mapproxy-intro.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=MapProxy Introduction
Comment=MapProxy Introduction
Categories=Application;Geography;Geoscience;Education;
Exec=firefox http://localhost/osgeolive/en/overview/mapproxy_overview.html
Icon=gnome-globe
Terminal=false
StartupNotify=false
EOF

cp -a /usr/share/applications/mapproxy-intro.desktop "$USER_HOME/Desktop/"
chown -R $USER_NAME:$USER_NAME "$USER_HOME/Desktop/mapproxy-intro.desktop"

echo "Creating Configuration"
cat << EOF > "$MAPPROXY_DIR/mapproxy.yaml"
services:
  demo:
  kml:
  tms:
  wmts:
  wms:
    srs: ['EPSG:4326', 'EPSG:900913', 'EPSG:3857', 'EPSG:4258', 'EPSG:26915']
    # image_formats: ['image/jpeg', 'image/png']
    md:
      # metadata used in capabilities documents
      title: MapProxy WMS Proxy
      abstract: This is the fantastic MapProxy.
      online_resource: http://mapproxy.org/
      contact:
        person: <NAME> Here
        position: Technical Director
        organization:
        address: Fakestreet 123
        city: Somewhere
        postcode: 12345
        country: Germany
        phone: +49(0)000-000000-0
        fax: +49(0)000-000000-0
        email: <EMAIL>
      access_constraints:
        This service is intended for private and evaluation use only.
        The data is licensed as Creative Commons Attribution-Share Alike 2.0
        (http://creativecommons.org/licenses/by-sa/2.0/)
      fees: 'None'

layers:
  - name: tilelite
    title: World population (Mapnik + TileLite TMS)
    sources: [tilelite_cache]
  - name: mapnik
    title: World population (Mapnik, uncached)
    sources: [mapnik]
  - name: mapserver
    title: Mapserver (Itasca)
    sources: [mapserver]
  - name: geoserver
    title: US Population (Geoserver WMS)
    sources: [geoserver]
  - name: mapnik_geoserver
    title: World population (Mapnik) + US Population (Geoserver WMS)
    sources: [mapnik, geoserver]

caches:
  tilelite_cache:
    grids: [GLOBAL_MERCATOR]
    sources: [tilelite]

sources:
  geoserver:
    type: wms
    wms_opts:
      featureinfo: true
    req:
      url: http://localhost:8082/geoserver/wms?
      layers: 'topp:states'
      transparent: true
    coverage:
      bbox: -124.73142200000001,24.955967,-66.969849,49.371735
      bbox_srs: 'EPSG:4326'

  tilelite:
    type: tile
    url: http://127.0.0.1:8012/%(z)d/%(x)d/%(y)d.png
    grid: global_mercator_inverse
    transparent: true

  mapnik:
    type: mapnik
    use_mapnik2: true
    mapfile: /usr/local/share/mapnik/demo/population.xml

  mapserver:
    type: wms
    supported_srs: ['epsg:26915']
    req:
      url: http://localhost/cgi-bin/mapserv?
      layers: airports,cities,lakespy2,dlgstln2,roads,twprgpy3
      map: /usr/local/www/docs_maps/mapserver_demos/workshop/itasca.map
    coverage:
      bbox: 363016.590190,5148502.940313,588593.999470,5374080.349593
      bbox_srs: 'epsg:26915'

 # overlay_full_example:
  #   type: wms
  #   concurrent_requests: 4
  #   wms_opts:
  #     version: 1.3.0<commit_msg>Replaced Tilelite with Tilestache in MapProxy demo (#1701)<commit_after>#!/bin/sh
#
# Install MapProxy server
#
# Created by <NAME> <<EMAIL>>
# Copyright (c) 2010-2016 The Open Source Geospatial Foundation.
# Licensed under the GNU LGPL version >= 2.1.

./diskspace_probe.sh "`basename $0`" begin
BUILD_DIR=`pwd`
####

if [ -z "$USER_NAME" ] ; then
   USER_NAME="user"
fi
USER_HOME="/home/$USER_NAME"

BIN="/usr/local/bin"
TMP="/tmp/build_mapproxy"
MAPPROXY_VERSION="1.8.2"
MAPPROXY_DOCS_FILE="MapProxy-docs-1.8.0.tar.gz"
MAPPROXY_DOCS_URL="http://mapproxy.org/static/rel/$MAPPROXY_DOCS_FILE"
MAPPROXY_DIR="/usr/local/share/mapproxy"

apt-get install --yes python-mapproxy

mkdir -p "$TMP"
cd "$TMP"

echo "Downloading: $MAPPROXY_DOCS_URL"
wget --timestamping --continue --progress=dot:mega "$MAPPROXY_DOCS_URL"
if [ $? -ne 0 ] ; then
   echo "ERROR: download failed"
   exit 1
fi

mkdir -p $MAPPROXY_DIR/docs
echo "Extracting docs: $MAPPROXY_DOCS_FILE"
tar -xz --strip-components 1 -C "$MAPPROXY_DIR"/docs -f "$MAPPROXY_DOCS_FILE"
if [ $? -ne 0 ] ; then
   echo "ERROR: docs install failed"
   exit 1
fi
ln -sf "$MAPPROXY_DIR/docs" /var/www/html/mapproxy

echo "Creating Scripts/Links"
# Create startup script for MapProxy Server
cat << EOF > "$BIN/mapproxy_start.sh"
#!/bin/sh
mapproxy-util serve-develop -b 0.0.0.0:8011 /usr/local/share/mapproxy/mapproxy.yaml
EOF

chmod 755 $BIN/mapproxy_start.sh


## Create Desktop Shortcut for starting MapProxy Server in shell
cat << EOF > /usr/share/applications/mapproxy-start.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Start MapProxy
Comment=MapProxy for LiveDVD WMS services
Categories=Application;Geography;Geoscience;Education;
Exec=lxterminal -e mapproxy_start.sh
Icon=gnome-globe
Terminal=false
StartupNotify=false
EOF

cp -a /usr/share/applications/mapproxy-start.desktop "$USER_HOME/Desktop/"
chown -R $USER_NAME:$USER_NAME "$USER_HOME/Desktop/mapproxy-start.desktop"

# Create Desktop Shortcut for Basic Intro page and Demo
cat << EOF > /usr/share/applications/mapproxy-intro.desktop
[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=MapProxy Introduction
Comment=MapProxy Introduction
Categories=Application;Geography;Geoscience;Education;
Exec=firefox http://localhost/osgeolive/en/overview/mapproxy_overview.html
Icon=gnome-globe
Terminal=false
StartupNotify=false
EOF

cp -a /usr/share/applications/mapproxy-intro.desktop "$USER_HOME/Desktop/"
chown -R $USER_NAME:$USER_NAME "$USER_HOME/Desktop/mapproxy-intro.desktop"

echo "Creating Configuration"
cat << EOF > "$MAPPROXY_DIR/mapproxy.yaml"
services:
  demo:
  kml:
  tms:
  wmts:
  wms:
    srs: ['EPSG:4326', 'EPSG:900913', 'EPSG:3857', 'EPSG:4258', 'EPSG:26915']
    # image_formats: ['image/jpeg', 'image/png']
    md:
      # metadata used in capabilities documents
      title: MapProxy WMS Proxy
      abstract: This is the fantastic MapProxy.
      online_resource: http://mapproxy.org/
      contact:
        person: <NAME>
        position: Technical Director
        organization:
        address: Fakestreet 123
        city: Somewhere
        postcode: 12345
        country: Germany
        phone: +49(0)000-000000-0
        fax: +49(0)000-000000-0
        email: <EMAIL>
      access_constraints:
        This service is intended for private and evaluation use only.
        The data is licensed as Creative Commons Attribution-Share Alike 2.0
        (http://creativecommons.org/licenses/by-sa/2.0/)
      fees: 'None'

layers:
  - name: tilestache
    title: World population (Mapnik + Tilestache TMS)
    sources: [tilestache_cache]
  - name: mapnik
    title: World population (Mapnik, uncached)
    sources: [mapnik]
  - name: mapserver
    title: Mapserver (Itasca)
    sources: [mapserver]
  - name: geoserver
    title: US Population (Geoserver WMS)
    sources: [geoserver]
  - name: mapnik_geoserver
    title: World population (Mapnik) + US Population (Geoserver WMS)
    sources: [mapnik, geoserver]

caches:
  tilestache_cache:
    grids: [GLOBAL_MERCATOR]
    sources: [tilestache]

sources:
  geoserver:
    type: wms
    wms_opts:
      featureinfo: true
    req:
      url: http://localhost:8082/geoserver/wms?
      layers: 'topp:states'
      transparent: true
    coverage:
      bbox: -124.73142200000001,24.955967,-66.969849,49.371735
      bbox_srs: 'EPSG:4326'

  tilestache:
    type: tile
    url: http://127.0.0.1:8012/example/%(z)d/%(x)d/%(y)d.png
    grid: global_mercator_inverse
    transparent: true

  mapnik:
    type: mapnik
    use_mapnik2: true
    mapfile: /usr/local/share/mapnik/demo/population.xml

  mapserver:
    type: wms
    supported_srs: ['epsg:26915']
    req:
      url: http://localhost/cgi-bin/mapserv?
      layers: airports,cities,lakespy2,dlgstln2,roads,twprgpy3
      map: /usr/local/www/docs_maps/mapserver_demos/workshop/itasca.map
    coverage:
      bbox: 363016.590190,5148502.940313,588593.999470,5374080.349593
      bbox_srs: 'epsg:26915'

 # overlay_full_example:
  #   type: wms
  #   concurrent_requests: 4
  #   wms_opts:
  #     version: 1.3.0
{'fraction_non_alphanumeric': 0.12037405491444489, 'fraction_numerical': 0.044767210505372065, 'mean_word_length': 3.688899253731343, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 2}, 'pii_count': 4, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1644697', 'n_tokens_mistral': 3989, 'n_tokens_neox': 3718, 'n_words': 799}