source: subversion/applications/rendering/toposm/env.py @ 29599

Last change on this file since 29599 was 25435, checked in by ahlzen, 9 years ago

Minor refactoring and cleanup of the TopOSM code.

File size: 1.7 KB
Line 
1#!/usr/bin/python
2
3"""env.py: Initializes the TopOSM render environment."""
4
5import os
6import sys
7
8__author__      = "Lars Ahlzen"
9__copyright__   = "(c) Lars Ahlzen 2008-2011"
10__license__     = "GPLv2"
11
12
13##### Import environment variables
14
15# Check that the environment is set and import configuration
16if not 'TOPOSM_ENV_SET' in os.environ:
17    print "Error: TopOSM environment not set."
18    sys.exit(1)
19
20BASE_TILE_DIR = os.environ['BASE_TILE_DIR']
21CONTOURS_TABLE = os.environ['CONTOURS_TABLE']
22DATABASE = os.environ['DB_NAME']
23TEMPDIR = os.environ['TEMP_DIR']
24NED13DIR = os.environ['NED13_DIR']
25HILLSHADE = os.environ['HILLSHADE']
26COLORRELIEF = os.environ['COLORRELIEF']
27COLORFILE = os.environ['COLORFILE']
28NUM_THREADS = int(os.environ['RENDER_THREADS'])
29TILE_SIZE = int(os.environ['TILE_SIZE'])
30BORDER_WIDTH = int(os.environ['BORDER_WIDTH'])
31ERRORLOG = os.environ['ERROR_LOG']
32JPEG_QUALITY = os.environ['JPEG_QUALITY']
33
34##### Common constants
35
36#CONTOUR_INTERVAL = 15.24 # 50 ft in meters
37CONTOUR_INTERVAL = 7.62 # 25 ft in meters
38MAPNIK_LAYERS = [
39    'watermask', 'area', 'areansh', 'contourlines', 'contourlabels',
40    'features-main', 'features-fill', 'labels', 'labels-nohalo']
41
42# Optimal supertile size (N x N subtiles) by zoom level.
43# A too low number is inefficient. A too high number uses
44# large amounts of memory and sometimes breaks the gdal tools.
45NTILES = {
46    1:1, 2:1, 3:1, 4:1, 5:1, 6:1, 7:1, 8:1, 9:1, 10:1,
47    11:2, 12:4, 13:6, 14:8, 15:10, 16:12, 17:12, 18:12,
48    19:12, 20:12 }
49
50LATLONG_PROJECTION_DEF = "+proj=latlong"
51MERCATOR_PROJECTION_DEF = "+proj=merc +a=6378137 +b=6378137 " + \
52    "+lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m " + \
53    "+nadgrids=@null +no_defs +over"
54
Note: See TracBrowser for help on using the repository browser.