Skip to content

Commit

Permalink
mixed: use where appropriate and comment out missing layer definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
bnordgren committed Dec 10, 2016
1 parent c900716 commit 7722a25
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion NED.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion prep_contours_table
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 10 additions & 8 deletions toposm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down

0 comments on commit 7722a25

Please sign in to comment.