Skip to content

Commit

Permalink
+ merge mapnik2 to trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
artemp committed Dec 16, 2009
1 parent 0ccdac0 commit 47dc1e1
Show file tree
Hide file tree
Showing 220 changed files with 6,822 additions and 11,769 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Mapnik 0.7.0 Release

- Gdal Plugin: Add support for Gdal overviews, enabling fast loading of > 1GB rasters (#54)

- Rasterlite Plugin: Experimental support for Rasterlite, to practically use sqlite database with wavelet compressed rasters

- PostGIS: Added an optional 'geometry_table' parameter. This is used by Mapnik to look up metadata in the
geometry_columns and calculate extents (when the 'geometry_field' and 'srid' parameters are not supplied).
If 'geometry_table' is not specified Mapnik will attempt to determine the name of the table to query based
Expand Down
17 changes: 10 additions & 7 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ PLUGINS = { # plugins with external dependencies
'ogr': {'default':False,'path':None,'inc':'ogrsf_frmts.h','lib':'gdal','lang':'C++'},
'occi': {'default':False,'path':'OCCI','inc':'occi.h','lib':'ociei','lang':'C++'},
'sqlite': {'default':False,'path':'SQLITE','inc':'sqlite3.h','lib':'sqlite3','lang':'C'},
'rasterlite': {'default':False,'path':'RASTERLITE','inc':['sqlite3.h','rasterlite.h'],'lib':'rasterlite','lang':'C'},

# plugins without external dependencies requiring CheckLibWithHeader...
# note: osm plugin does depend on libxml2
Expand Down Expand Up @@ -169,6 +170,8 @@ opts.AddVariables(
PathVariable('OCCI_LIBS', 'Search path for OCCI library files', '/usr/lib/oracle/10.2.0.3/client/'+ LIBDIR_SCHEMA, PathVariable.PathAccept),
PathVariable('SQLITE_INCLUDES', 'Search path for SQLITE include files', '/usr/include/', PathVariable.PathAccept),
PathVariable('SQLITE_LIBS', 'Search path for SQLITE library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),
PathVariable('RASTERLITE_INCLUDES', 'Search path for RASTERLITE include files', '/usr/include/', PathVariable.PathAccept),
PathVariable('RASTERLITE_LIBS', 'Search path for RASTERLITE library files', '/usr/' + LIBDIR_SCHEMA, PathVariable.PathAccept),

# Other variables
BoolVariable('SHAPE_MEMORY_MAPPED_FILE', 'Utilize memory-mapped files in Shapefile Plugin (higher memory usage, better performance)', 'True'),
Expand Down Expand Up @@ -375,7 +378,7 @@ def FindBoost(context, prefixes, thread_flag):
search_lib = 'libboost_thread'
else:
search_lib = 'libboost_filesystem'
prefixes.insert(0,os.path.dirname(env['BOOST_INCLUDES']))
prefixes.insert(0,os.path.dirname(env['BOOST_LIBS']))
for searchDir in prefixes:
Expand Down Expand Up @@ -698,11 +701,11 @@ if not preconfigured:
BOOST_LIBSHEADERS.append(['thread', 'boost/thread/mutex.hpp', True])

# if the user is not setting custom boost configuration
# enforce boost version greater than or equal to 1.34
if not conf.CheckBoost('1.34'):
color_print (1,'Boost version 1.34 or greater is requred')
# enforce boost version greater than or equal to 1.41
if not conf.CheckBoost('1.41'):
color_print (1,'Boost version 1.41 or greater is requred')
if not env['BOOST_VERSION']:
env['MISSING_DEPS'].append('boost version >=1.34')
env['MISSING_DEPS'].append('boost version >=1.41')
else:
color_print (4,'Found boost lib version... %s' % boost_lib_version_from_header )

Expand Down Expand Up @@ -783,7 +786,7 @@ if not preconfigured:
if env['SKIPPED_DEPS']:
color_print(4,'\nAlso, these optional dependencies were not found:\n - %s' % '\n - '.join(env['SKIPPED_DEPS']))
color_print(4,"\nSet custom paths to these libraries and header files on the command-line or in a file called '%s'" % SCONS_LOCAL_CONFIG)
color_print(4," ie. $ python scons/scons.py BOOST_INCLUDES=/usr/local/include/boost-1_37 BOOST_LIBS=/usr/local/lib")
color_print(4," ie. $ python scons/scons.py BOOST_INCLUDES=/usr/local/include BOOST_LIBS=/usr/local/lib")
color_print(4, "\nOnce all required dependencies are found a local '%s' will be saved and then install:" % SCONS_LOCAL_CONFIG)
color_print(4," $ sudo python scons/scons.py install")
color_print(4,"\nTo view available path variables:\n $ python scons/scons.py --help or -h")
Expand Down Expand Up @@ -866,7 +869,7 @@ if not preconfigured:
env.Append(CXXFLAGS = common_cxx_flags + '-O %s' % ndebug_flags)
else:
# Common flags for GCC.
gcc_cxx_flags = '-ansi -Wall %s -ftemplate-depth-100 %s' % (pthread, common_cxx_flags)
gcc_cxx_flags = '-ansi -Wall %s -ftemplate-depth-200 %s' % (pthread, common_cxx_flags)

if env['DEBUG']:
env.Append(CXXFLAGS = gcc_cxx_flags + '-O0 -fno-inline %s' % debug_flags)
Expand Down
42 changes: 31 additions & 11 deletions bindings/python/mapnik/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ def inverse(self, projection):
"""
return inverse_(self, projection)

class _Envelope(Envelope,_injector):
class _Box2d(Box2d,_injector):
"""
Represents a spatial envelope (i.e. bounding box).
Following operators are defined for Envelope:
Following operators are defined for Box2d:
Addition:
e1 + e2 is equvalent to e1.expand_to_include(e2) but yields
Expand All @@ -165,7 +165,7 @@ class _Envelope(Envelope,_injector):
Equality: two envelopes are equal if their corner points are equal.
"""
def __repr__(self):
return 'Envelope(%s,%s,%s,%s)' % \
return 'Box2d(%s,%s,%s,%s)' % \
(self.minx,self.miny,self.maxx,self.maxy)
def forward(self, projection):
"""
Expand Down Expand Up @@ -193,21 +193,21 @@ def __repr__(self):
return "Projection('%s')" % self.params()
def forward(self,obj):
"""
Projects the given object (Envelope or Coord)
Projects the given object (Box2d or Coord)
from the geographic space into the cartesian space.
See also:
Envelope.forward(self, projection),
Box2d.forward(self, projection),
Coord.forward(self, projection).
"""
return forward_(obj,self)
def inverse(self,obj):
"""
Projects the given object (Envelope or Coord)
Projects the given object (Box2d or Coord)
from the cartesian space into the geographic space.
See also:
Envelope.inverse(self, projection),
Box2d.inverse(self, projection),
Coord.inverse(self, projection).
"""
return inverse_(obj,self)
Expand Down Expand Up @@ -337,7 +337,7 @@ def Raster(**keywords):
hix -- highest (max) x/longitude of tiff extent
hiy -- highest (max) y/latitude of tiff extent
Hint: lox,loy,hix,hiy make a Mapnik Envelope
Hint: lox,loy,hix,hiy make a Mapnik Box2d
Optional keyword arguments:
base -- path prefix (default None)
Expand Down Expand Up @@ -450,6 +450,26 @@ def SQLite(**keywords):
keywords['type'] = 'sqlite'
return CreateDatasource(keywords)

def Rasterlite(**keywords):
"""Create a Rasterlite Datasource.
Required keyword arguments:
file -- path to Rasterlite database file
table -- table name or subselect query
Optional keyword arguments:
base -- path prefix (default None)
extent -- manually specified data extent (comma delimited string, default None)
>>> from mapnik import Rasterlite, Layer
>>> rasterlite = Rasterlite(base='/home/mapnik/data',file='osm.db',table='osm',extent='-20037508,-19929239,20037508,19929239')
>>> lyr = Layer('Rasterlite Layer')
>>> lyr.datasource = rasterlite
"""
keywords['type'] = 'rasterlite'
return CreateDatasource(keywords)

def Osm(**keywords):
"""Create a Osm Datasource.
Expand Down Expand Up @@ -524,7 +544,7 @@ def register_fonts(path=fontscollectionpath):
# classes
'Color', 'Coord',
'DatasourceCache',
'Envelope',
'Box2d',
'Feature', 'Featureset', 'FontEngine',
'Geometry2d',
'Image', 'ImageView',
Expand All @@ -537,7 +557,6 @@ def register_fonts(path=fontscollectionpath):
'PolygonPatternSymbolizer', 'PolygonSymbolizer',
'ProjTransform',
'Projection',
'Properties',
'Query',
'RasterSymbolizer',
'Rule', 'Rules',
Expand All @@ -562,7 +581,8 @@ def register_fonts(path=fontscollectionpath):
'mapnik_version_string', 'mapnik_version', 'mapnik_svn_revision',
'has_cairo', 'has_pycairo',
# factory methods
'Filter',
'Expression',
'PathExpression',
# load/save/render
'load_map', 'load_map_from_string', 'save_map', 'save_map_to_string',
'render', 'render_tile_to_file', 'render_to_file',
Expand Down
4 changes: 2 additions & 2 deletions bindings/python/mapnik/ogcserver/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"""Core OGCServer classes and functions."""

from exceptions import OGCException, ServerConfigurationError
from mapnik import Map, Color, Envelope, render, Image, Layer, Style, Projection as MapnikProjection, Coord
from mapnik import Map, Color, Box2d, render, Image, Layer, Style, Projection as MapnikProjection, Coord
from PIL.Image import new
from PIL.ImageDraw import Draw
from StringIO import StringIO
Expand Down Expand Up @@ -409,7 +409,7 @@ def _buildMap(self, params):
else:
raise ServerConfigurationError('Layer "%s" refers to non-existent style "%s".' % (layername, stylename))
m.layers.append(layer)
m.zoom_to_box(Envelope(params['bbox'][0], params['bbox'][1], params['bbox'][2], params['bbox'][3]))
m.zoom_to_box(Box2d(params['bbox'][0], params['bbox'][1], params['bbox'][2], params['bbox'][3]))
return m

class BaseExceptionHandler:
Expand Down
4 changes: 2 additions & 2 deletions bindings/python/mapnik/ogcserver/wms130.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from common import ParameterDefinition, Response, Version, ListFactory, \
ColorFactory, CRSFactory, CRS, WMSBaseServiceHandler, \
BaseExceptionHandler, Projection, Envelope
BaseExceptionHandler, Projection, Box2d
from exceptions import OGCException, ServerConfigurationError
from mapnik import Coord

Expand Down Expand Up @@ -238,7 +238,7 @@ def _buildMap(self, params):
m = WMSBaseServiceHandler._buildMap(self, params)
# for range of epsg codes reverse axis
if params['crs'].code >= 4000 and params['crs'].code < 5000:
m.zoom_to_box(Envelope(params['bbox'][1], params['bbox'][0], params['bbox'][3], params['bbox'][2]))
m.zoom_to_box(Box2d(params['bbox'][1], params['bbox'][0], params['bbox'][3], params['bbox'][2]))
return m

class ExceptionHandler(BaseExceptionHandler):
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/mapnik_datasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <vector>

// mapnik
#include <mapnik/envelope.hpp>
#include <mapnik/box2d.hpp>
#include <mapnik/datasource.hpp>
#include <mapnik/datasource_cache.hpp>
#include <mapnik/feature_layer_desc.hpp>
Expand Down
Loading

0 comments on commit 47dc1e1

Please sign in to comment.