-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
181 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
|
||
if grep -q "/usr/local/etc/renderd.conf" /etc/apache2/sites-available/000-default.conf ; then | ||
echo "renderd was already added to apache config" | ||
else | ||
sed -i "s|ServerAdmin webmaster@localhost|ServerAdmin webmaster@localhost\n\tLoadTileConfigFile /usr/local/etc/renderd.conf\n\tModTileRenderdSocketName /var/run/renderd/renderd.sock\n\tModTileRequestTimeout 0\n\tModTileMissingRequestTimeout 30|" /etc/apache2/sites-available/000-default.conf | ||
fi | ||
|
||
a2enconf mod_tile | ||
service apache2 reload | ||
sudo -u algogis renderd -f -c /usr/local/etc/renderd.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
NEW_PATH="/srv/postgresql" | ||
OLD_PATH="/var/lib/postgresql/9.4/main" | ||
FILE_PATH="/etc/postgresql/9.4/main/postgresql.conf" | ||
|
||
# REMOVE OLD DIRS | ||
rm -rf /srv/ | ||
|
||
# STOP SERVICES | ||
systemctl stop postgresql | ||
|
||
# CHANGE POSTGRES DIRECTORY | ||
sed -i "s|$OLD_PATH|$NEW_PATH|g" $FILE_PATH | ||
|
||
# CREATE STRUCTURE | ||
mkdir -p /srv/postgresql | ||
mkdir /srv/styles | ||
mkdir /srv/planet | ||
|
||
# COPY POSTGRESQL | ||
cp -r $OLD_PATH/. $NEW_PATH/ | ||
|
||
# FIX PERMISSIONS | ||
chown -R postgres:postgres /srv/postgresql/ | ||
chmod 700 /srv/postgresql/ | ||
|
||
|
||
|
||
# START SERVICES | ||
systemctl start postgresql | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/bash | ||
|
||
file_name="/usr/local/etc/renderd.conf" | ||
|
||
sed -i "s|;socketname=/var/run/renderd/renderd.sock|socketname=/var/run/renderd/renderd.sock|g" $file_name | ||
|
||
sed -i "s|plugins_dir=/usr/lib/mapnik/input|plugins_dir=/usr/local/lib/mapnik/input|g" $file_name | ||
|
||
sed -i "s|font_dir=/usr/share/fonts/truetype|font_dir=/usr/share/fonts/truetype/ttf-dejavu|g" $file_name | ||
|
||
sed -i "s|XML=/home/jburgess/osm/svn.openstreetmap.org/applications/rendering/mapnik/osm-local.xml|XML=/srv/styles/OSMBright/OSMBright.xml|g" $file_name | ||
|
||
sed -i "s|HOST=tile.openstreetmap.org|HOST=localhost|g" $file_name | ||
echo "changed config file /usr/local/etc/renderd.conf" | ||
if [ ! -d "/var/run/renderd" ] && [ ! -d "/var/lib/mod_tile" ]; then | ||
mkdir /var/run/renderd | ||
mkdir /var/lib/mod_tile | ||
chown algogis /var/run/renderd | ||
chown algogis /var/lib/mod_tile | ||
echo "renderd dir created at /var/run/renderd" | ||
echo "mod_tile dir created at /var/lib/mod_tile" | ||
fi | ||
if [ ! -f "/etc/apache2/conf-available/mod_tile.conf" ]; then | ||
echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" >> /etc/apache2/conf-available/mod_tile.conf | ||
echo "Mod_tile config created at /etc/apache2/conf-available/" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
if [ -d "/srv/planet/" ]; then | ||
echo "A dataset already exists at /srv/planet/ this action could overwrite the existing dataset. Do you want to proceed?(y/n)" | ||
read proceed | ||
if [ ! $proceed == "y" ]; then | ||
exit 1; | ||
fi | ||
|
||
fi | ||
mkdir -p /srv/planet | ||
cd /srv/planet | ||
echo "Planet (p), Hamburg (h) or Germany (g) dataset ?:" | ||
read dataset | ||
file="" | ||
file_name="" | ||
if [ $dataset == "p" ]; then | ||
file="http://planet.openstreetmap.org/pbf/planet-latest.osm.pbf" | ||
file_name="planet-latest.osm.pbf" | ||
elif [ $dataset == "g" ]; then | ||
file="http://download.geofabrik.de/europe/germany-latest.osm.pbf" | ||
file_name="germany-latest.osm.pbf" | ||
elif [ $dataset == "h" ]; then | ||
file="http://download.geofabrik.de/europe/germany/hamburg-latest.osm.pbf" | ||
file_name="hamburg-latest.osm.pbf" | ||
fi | ||
if [ ! $file == "" ] && [ ! $file_name == "" ]; then | ||
if [ ! -f "/srv/planet/$file_name" ]; then | ||
wget $file | ||
fi | ||
else | ||
exit 1; | ||
fi | ||
chown -R algogis /srv/planet/ | ||
echo "Do you want to use fast and slowspace ?(y/n)" | ||
read fast | ||
|
||
if [ $fast == "y" ]; then | ||
exit 1; | ||
else | ||
sudo -u algogis osm2pgsql --verbose --unlogged --cache-strategy dense --create --slim --drop -d gis -C 4096 --number-processes 2 --disable-parallel-indexing --flat-nodes /srv/planet/nodes.flat $file_name | ||
fi | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/bash | ||
|
||
MASTER_STYLE="https://github.com/mapbox/osm-bright/archive/master.zip" | ||
SIMPLIFIED_POLY="http://data.openstreetmapdata.com/simplified-land-polygons-complete-3857.zip" | ||
LAND_POLY="http://data.openstreetmapdata.com/land-polygons-split-3857.zip" | ||
SIMPLIFIED_SHAPE_NEW="\"/srv/osm-bright-master/shp/simplified-land-polygons-complete-3857/simplified-land-polygons-complete-3857.shp\", \"type\": \"shape\"" | ||
|
||
SIMPLIFIED_SHAPE_OLD="\"http://data.openstreetmapdata.com/simplified-land-polygons-complete-3857.zip\"" | ||
|
||
SPLIT_SHAPE_OLD="\"http://data.openstreetmapdata.com/land-polygons-split-3857.zip\"" | ||
|
||
SPLIT_SHAPE_NEW="\"/srv/osm-bright-master/shp/land-polygons-split-3857/land-polygons-split-3857.shp\", \"type\": \"shape\"" | ||
|
||
PROJECT_FILE="/srv/styles/osm-bright-master/osm-bright/osm-bright.osm2pgsql.mml" | ||
# DOWNLOAD STYLES | ||
mkdir /srv/styles | ||
cd /srv/styles | ||
wget $MASTER_STYLE | ||
wget $SIMPLIFIED_POLY | ||
wget $LAND_POLY | ||
|
||
# UNZIP & MOVE | ||
unzip '*.zip' | ||
rm -rf /srv/styles/*.zip | ||
mkdir osm-bright-master/shp | ||
mv land-polygons-split-3857 osm-bright-master/shp/ | ||
mv simplified-land-polygons-complete-3857 osm-bright-master/shp/ | ||
|
||
# INDEX SHAPES | ||
cd osm-bright-master/shp/land-polygons-split-3857 | ||
shapeindex land_polygons.shp | ||
cd ../simplified-land-polygons-complete-3857/ | ||
shapeindex simplified_land_polygons.shp | ||
cd ../.. | ||
|
||
# REPLACE SHAPE FILES & REMOVE POPULATED | ||
sed -i "s|$SIMPLIFIED_SHAPE_OLD|$SIMPLIFIED_SHAPE_NEW|g" $PROJECT_FILE | ||
sed -i "s|$SPLIT_SHAPE_OLD|$SPLIT_SHAPE_NEW|g" $PROJECT_FILE | ||
sed -i '401,413 d' $PROJECT_FILE | ||
# Configure style | ||
cp /srv/styles/osm-bright-master/configure.py.sample /srv/styles/osm-bright-master/configure.py | ||
|
||
sed -i 's/osm\"/gis\"/' /srv/styles/osm-bright-master/configure.py | ||
sed -i 's|~/Documents/MapBox/project|/srv/styles|' srv/styles/osm-bright-master/configure.py | ||
|
||
# Compile style | ||
cd /srv/styles/osm-bright-master/ | ||
./make.py | ||
pushd ../OSMBright | ||
sh -c "carto project.mml > OSMBright.xml" | ||
popd | ||
|
||
# Set permissions | ||
chown -R algogis /srv/styles | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
DATABASE_NAME="gis" | ||
|
||
# SETUP USER FOR DB | ||
sudo -u postgres createuser algogis | ||
sudo -u postgres createdb -E UTF8 -O algogis gis | ||
useradd -m algogis | ||
|
||
# SETUP DB | ||
sudo -u postgres psql $DATABASE_NAME -c 'CREATE EXTENSION postgis;ALTER TABLE geometry_columns OWNER TO algogis; ALTER TABLE spatial_ref_sys OWNER TO algogis;' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters