From 7722a253eb435c17471cc52f0b892b5a9034e9f0 Mon Sep 17 00:00:00 2001 From: Bryce Nordgren Date: Sat, 10 Dec 2016 14:30:10 +0000 Subject: [PATCH] mixed: use where appropriate and comment out missing layer definitions --- NED.py | 2 +- env.py | 9 ++++++--- prep_contours_table | 2 +- toposm.py | 18 ++++++++++-------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/NED.py b/NED.py index 006e4bd..6fa1a6d 100644 --- a/NED.py +++ b/NED.py @@ -129,7 +129,7 @@ def prepDataFile(basename, env): print ' Importing contour lines...' # NOTE: this assumes that the table is already set up cmd = 'shp2pgsql -a -g way -s 32100 "%s" "%s" | psql -q -U %s -h %s "%s"' % \ - (contourfileproj, CONTOURS_TABLE, DB_USER, DB_HOST, DATABASE) + (contourfileproj, CONTOURS_TABLE, DB_USER, DB_HOST, CONTOURS_DB) os.system(cmd) # Clear contents (but keep file to prevent us from importing diff --git a/env.py b/env.py index b9f531c..6645849 100644 --- a/env.py +++ b/env.py @@ -18,6 +18,7 @@ sys.exit(1) BASE_TILE_DIR = os.environ['BASE_TILE_DIR'] +CONTOURS_DB = os.environ['CONTOURS_DB'] CONTOURS_TABLE = os.environ['CONTOURS_TABLE'] DATABASE = os.environ['DB_NAME'] DB_USER = os.environ['DB_USER'] @@ -46,10 +47,12 @@ CONTOUR_INTERVAL = 5 AGG_LAYERS = frozenset(['hypsorelief', 'areas', 'ocean']) -CAIRO_LAYERS = frozenset(['contour-labels', 'contour-mask', 'contours', - 'features_fills', 'features_labels', 'features_mask', - 'features_outlines', 'features_top']) +CAIRO_LAYERS = frozenset(['contours', 'features']) +#CAIRO_LAYERS = frozenset(['contour-labels', 'contour-mask', 'contours', +# 'features_fills', 'features_labels', 'features_mask', +# 'features_outlines', 'features_top']) MAPNIK_LAYERS = AGG_LAYERS | CAIRO_LAYERS +#MAPNIK_LAYERS = AGG_LAYERS # Optimal metatile size (N x N subtiles) by zoom level. # A too low number is inefficient. A too high number uses diff --git a/prep_contours_table b/prep_contours_table index 7ebfc4d..4dc7070 100755 --- a/prep_contours_table +++ b/prep_contours_table @@ -5,7 +5,7 @@ if [[ -z $TOPOSM_ENV_SET ]]; then exit 1 fi -DBCMD="psql -q -p $DB_PORT -h $DB_HOST $DB_NAME $DB_USER" +DBCMD="psql -q -U $DB_USER -p $DB_PORT -h $DB_HOST $CONTOURS_DB" shp2pgsql -p -I -g way contours.shp $CONTOURS_TABLE | $DBCMD echo "ALTER TABLE $CONTOURS_TABLE ADD COLUMN height_ft INT" | $DBCMD diff --git a/toposm.py b/toposm.py index 537bdd3..7ed077c 100755 --- a/toposm.py +++ b/toposm.py @@ -236,18 +236,20 @@ def renderMetaTile(z, x, y, ntiles, maps): def combineLayers(images): console.debugMessage(' Combining layers') - images['contour-mask'].set_grayscale_to_alpha() - images['features_mask'].set_grayscale_to_alpha() + #images['contour-mask'].set_grayscale_to_alpha() + #images['features_mask'].set_grayscale_to_alpha() return getComposite(( images['hypsorelief'], images['areas'], images['ocean'], - getMask(images['contours'], images['contour-mask']), - images['contour-labels'], - getMask(images['features_outlines'], images['features_mask']), - images['features_fills'], - getMask(images['features_top'], images['features_mask']), - images['features_labels'])) + images['contours'], + images['features'])) + #getMask(images['contours'], images['contour-mask']), + #images['contour-labels'], + #getMask(images['features_outlines'], images['features_mask']), + #images['features_fills'], + #getMask(images['features_top'], images['features_mask']), + #images['features_labels'])) def renderMetatileLayer(name, z, x, y, ntiles, map): """Renders the specified map tile (layer) as a mapnik.Image."""