source: subversion/applications/rendering/toposm/combine-mapnik-tiles @ 34399

Last change on this file since 34399 was 24414, checked in by ahlzen, 9 years ago

Added support for rendering specific areas of interest.
Runs PNG optimizer after rendering.

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2
3# syntax: combine <rootTileDir> <z> <x> <y> <size(pixels)>
4
5ROOTTILEDIR=$1
6Z=$2
7X=$3
8Y=$4
9SIZE=$5
10
11# * Cuts "halos" from contour lines around contour labels
12# * Adds contour labels on top
13# * Optimizes PNG tile
14CONTOURSDESTDIR="$ROOTTILEDIR/contours/$Z"
15CONTOURSTILE="$CONTOURSDESTDIR/s${X}_${Y}.png"
16CONTOURLINESTILE="$ROOTTILEDIR/contourlines/$Z/s${X}_${Y}.png"
17CONTOURLABELSTILE="$ROOTTILEDIR/contourlabels/$Z/s${X}_${Y}.png"
18mkdir -p "$CONTOURSDESTDIR"
19if [ ! -f "$CONTOURSTILE" ] ; then
20    echo "Combining contours tile at $Z $X $Y..."
21    convert \
22            -size ${SIZE}x${SIZE} xc:black \( "$CONTOURLABELSTILE" -channel \
23        Alpha -blur 0x2.0 -channel matte -separate +channel -negate \
24        -level 5,8% \) -compose Copy_Opacity -composite \
25        "$CONTOURLINESTILE" -compose Src_Out -composite \
26            "$CONTOURLABELSTILE" -compose Over -composite \
27            -colors 256 -quality 90 -depth 8 "$CONTOURSTILE"
28        optipng -q "$CONTOURSTILE"
29else
30    echo "Contours tile at $Z $X $Y exists."
31fi
32rm "$CONTOURLABELSTILE"
33rm "$CONTOURLINESTILE"
34
35# * Starts with features-main
36# * Cuts out halos for labels
37# * Adds features-fill
38# * Adds labels
39# * Optimizes PNG tile
40FEATURESDESTDIR="$ROOTTILEDIR/features/$Z"
41FEATURESTILE="$FEATURESDESTDIR/s${X}_${Y}.png"
42FEATURESMAINTILE="$ROOTTILEDIR/features-main/$Z/s${X}_${Y}.png"
43FEATURESFILLTILE="$ROOTTILEDIR/features-fill/$Z/s${X}_${Y}.png"
44LABELSTILE="$ROOTTILEDIR/labels/$Z/s${X}_${Y}.png"
45LABELSNOHALOTILE="$ROOTTILEDIR/labels-nohalo/$Z/s${X}_${Y}.png"
46mkdir -p "$FEATURESDESTDIR"
47if [ ! -f "$FEATURESTILE" ] ; then
48    echo "Combining features tile at $Z $X $Y..."
49    convert \
50            \( \
51                -size ${SIZE}x${SIZE} xc:black \( "$LABELSTILE" -channel \
52                Alpha -blur 0x2.0 -channel matte -separate +channel -negate \
53                -level 5,8% \) -compose Copy_Opacity -composite \
54                "$FEATURESMAINTILE" -compose Src_Out -composite \
55            \) \
56            "$FEATURESFILLTILE" -compose Over -composite \
57            "$LABELSTILE" -compose Over -composite \
58            "$LABELSNOHALOTILE" -compose Over -composite \
59            "$FEATURESTILE"
60        optipng -q "$FEATURESTILE"
61else
62    echo "Features tile at $X $Y $Z exists."
63fi
64rm "$FEATURESMAINTILE"
65rm "$FEATURESFILLTILE"
66rm "$LABELSTILE"
67rm "$LABELSNOHALOTILE"
68
Note: See TracBrowser for help on using the repository browser.