Initial addition of build and packaging tools unique to C2F

This commit is contained in:
jcampanell-c2f 2021-03-22 10:56:03 -06:00
parent 18e53cd7fb
commit 2ab40b9397
6 changed files with 233 additions and 0 deletions

97
Tippecanoe.md Normal file
View File

@ -0,0 +1,97 @@
### How to install Tippecanoe in Ubuntu
Install dependicies
```
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev
Install git
```
sudo apt-get install git
Download tippecanoe
```
git clone https://github.com/mapbox/tippecanoe.git
Go into Root Directory
```
cd tippecanoe
Give make command
```
sudo make
Finally, do install
```
sudo make install
### How to install Tippecanoe in Centos
Install dependencies
```
sudo yum install -y gcc automake autoconf libtool make
Install packages
```
yum install -y gcc gcc-c++
Install sqlite
```
yum install sqlite-devel.x86_64 -y
Install zlib
```
yum install zlib-devel
Install git
```
yum install git
Clone the repository
```
git clone https://github.com/mapbox/tippecanoe.git
Go inside root directory
```
cd tippecanoe
Give make command
```
make
Finally, Install tippecanoe
```
make install
Check version
```
tippecanoe -v
```
Optional:
1. If you run as root user execute the below command and restart the server to reflect the changes
```sh
export PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/bin
```

68
tippecanoe.sh Executable file
View File

@ -0,0 +1,68 @@
#!/bin/bash
# Simplify the use of the Mapbox tippecanoe application. Switches in use when
# calling from this script to the application are outlined here:
# -o - to name the output file,
# -f - to delete the file that already exists with that name.
# -zg: Automatically choose a maxzoom that should be sufficient to clearly
# distinguish the features and the detail within each feature
# -r1: Do not automatically drop a fraction of points at low zoom levels, since
# clustering will be used instead
# -pf or --no-feature-limit: Don't limit tiles to 200,000 features
# -pk or --no-tile-size-limit: Don't limit tiles to 500K bytes
# -M bytes or --maximum-tile-bytes=bytes: Use the specified number of bytes as
# the maximum compressed tile size instead of 500K.
# -Bg If you use -Bg, it will guess a zoom level that will keep at most 50,000
# features in the densest tile
# -as or --drop-densest-as-needed: If a tile is too large, try to reduce it to
# under 500K by increasing the minimum spacing between features. The
# discovered spacing applies to the entire zoom level.
# -aC or --cluster-densest-as-needed: If a tile is too large, try to reduce its
# size by increasing the minimum spacing between features, and leaving one
# placeholder feature from each group.
# -as or --drop-densest-as-needed: If a tile is too large, try to reduce it to
# under 500K by increasing the minimum spacing between features. The
# discovered spacing applies to the entire zoom level.
# --extend-zooms-if-still-dropping: If even the tiles at high zoom levels are
# too big, keep adding zoom levels until one is reached that can represent
# all the features
# Start by putting the context of this script into the directory where the
# script was found.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR
if [ "$#" -gt 0 ]; then
echo $1
echo $2
if [ ! -z "$1" ]; then
if [[ ! -z "$2" && $2 == *"symbol"* ]]; then
echo "Inside"
errormessage=$(/data/connectedworld/libraries/tippecanoe/tippecanoe -Bg -r1 -f -o $1.mbtiles --drop-densest-as-needed $1.geojson 2>&1)
echo $errormessage
else
errormessage=$(/data/connectedworld/libraries/tippecanoe/tippecanoe -zg -f -o $1.mbtiles --drop-densest-as-needed --extend-zooms-if-still-dropping $1.geojson --extend-zooms-if-still-dropping 2>&1)
fi
if [[ $errormessage == *" is not valid UTF-8"* ]]; then
echo "Remove is not valid UTF-8"
iconv -f utf8 -t utf8 -c $1.geojson > $1_1.geojson
mv -f $1_1.geojson $1.geojson
if [[ ! -z "$2" && $2 == *"symbol"* ]]; then
/data/connectedworld/libraries/tippecanoe/tippecanoe -Bg -r1 -f -o $1.mbtiles --drop-densest-as-needed $1.geojson
else
/data/connectedworld/libraries/tippecanoe/tippecanoe -Bg -f -o $1.mbtiles --drop-densest-as-needed $1.geojson
fi
elif [[ $errormessage == *" without at least two distinct feature locations"* ]]; then
/data/connectedworld/libraries/tippecanoe/tippecanoe -f -o $1.mbtiles --drop-densest-as-needed $1.geojson
else
echo $errormessage
echo "no Exception occure"
fi
else
echo "Empty Arguments"
fi
else
echo "No arguments supplied"
fi

14
tools/build.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
# Get the script's directory and cd from there to the root of the source dir
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR/..
echo
echo "Note that the tippecanoe build MUST be done for the target system OS."
echo "This can be performed either on a system with the same OS or with "
echo "cross-compile tools."
echo
# g++/make build for the local system OS
make

12
tools/clean.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
# Get the script's directory and cd from there to the root of the source dir
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR/..
# gradle clean
make clean
# Get rid of any packages
rm tippecanoe-package.tgz
rm -rf package

16
tools/deploy.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# Get the script's directory and cd from there to the root of the source dir
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR
# Create the deployment locations
mkdir -p /data/connectedworld/libraries/tippecanoe
mkdir -p /data/connectedworld/scripts
# Copy over the executable and make sure it's runnable
cp tippecanoe /data/connectedworld/libraries/tippecanoe/
chmod 755 /data/connectedworld/libraries/tippecanoe/tippecanoe
# Copy over the script and make sure it's runnable
cp tippecanoe.sh /data/connectedworld/scripts/
chmod 755 /data/connectedworld/scripts/tippecanoe.sh

26
tools/package.sh Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
# Note that we aren't bothering with deployment config because, at the time
# of this writing, there is no platform specific config for this application.
# Get the script's directory and cd from there to the root of the source dir
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $DIR/..
# Clean out previous package data
rm -rf package
rm tippecanoe-package.tgz
# Create a deployable package in the package subdirectory
mkdir -p package
# Copy in the executable file,
cp tippecanoe package/
# the wrapper script,
cp tippecanoe.sh package/
# and the deploy script
cp tools/deploy.sh package/
# Tar it up
tar zcvf tippecanoe-package.tgz package