diff --git a/CHANGELOG b/CHANGELOG index f44f50db3..248265a0f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,12 +14,16 @@ For a complete change history, see the SVN log. Mapnik 2.0.1 ------------ +- Switched back to "libmapnik" and "import mapnik" rather than "mapnik2" (#941) + +- Removed svn_revision info from mapnik-config and python bindings as git is now used + +- Removed OGCServer from core - now at https://github.com/mapnik/OGCServer (e7f6267) + - Fixed SQLite open stability across platforms/versions (#854) - Fixed `mapnik-config --version` (#903) -- Switched back to "libmapnik" and "import mapnik" rather than "mapnik2" (#941) - - Support for PostGIS 2.0 (#956,#1083) - Workaround for boost interprocess compile error with recent gcc versions (#950,#1001,#1082) diff --git a/SConstruct b/SConstruct index 8004c7bc4..fe33b333d 100644 --- a/SConstruct +++ b/SConstruct @@ -374,7 +374,7 @@ opts.AddVariables( # Other variables BoolVariable('SHAPE_MEMORY_MAPPED_FILE', 'Utilize memory-mapped files in Shapefile Plugin (higher memory usage, better performance)', 'True'), ('SYSTEM_FONTS','Provide location for python bindings to register fonts (if given aborts installation of bundled DejaVu fonts)',''), - ('LIB_DIR_NAME','Name to use for the subfolder beside libmapnik where fonts and plugins are installed','mapnik2'), + ('LIB_DIR_NAME','Name to use for the subfolder beside libmapnik where fonts and plugins are installed','mapnik'), PathVariable('PYTHON','Full path to Python executable used to build bindings', sys.executable), BoolVariable('FRAMEWORK_PYTHON', 'Link against Framework Python on Mac OS X', 'True'), BoolVariable('PYTHON_DYNAMIC_LOOKUP', 'On OSX, do not directly link python lib, but rather dynamically lookup symbols', 'True'), @@ -425,7 +425,6 @@ pickle_store = [# Scons internal variables 'PYTHON_SYS_PREFIX', 'COLOR_PRINT', 'HAS_BOOST_SYSTEM', - 'SVN_REVISION', 'HAS_CAIRO', 'HAS_PYCAIRO', 'HAS_LIBXML2', @@ -525,11 +524,6 @@ if sys.platform == "win32": color_print(4,'\nWelcome to Mapnik...\n') -color_print(1,'*'*45) -color_print(1,'You are compiling Mapnik trunk (aka Mapnik2)') -color_print(1,'See important details at:\nhttp://trac.mapnik.org/wiki/Mapnik2') -color_print(1,('*'*45)+'\n') - #### Custom Configure Checks ### @@ -969,7 +963,6 @@ if not preconfigured: env['CAIROMM_CPPPATHS'] = [] env['HAS_PYCAIRO'] = False env['HAS_LIBXML2'] = False - env['SVN_REVISION'] = None env['LIBMAPNIK_LIBS'] = [] env['LIBMAPNIK_CPPATHS'] = [] env['LIBMAPNIK_CXXFLAGS'] = [] @@ -1010,9 +1003,9 @@ if not preconfigured: env['MAPNIK_FONTS_DEST'] = os.path.join(env['MAPNIK_LIB_DIR_DEST'],'fonts') if env['LINKING'] == 'static': - env['MAPNIK_LIB_NAME'] = '${LIBPREFIX}mapnik2${LIBSUFFIX}' + env['MAPNIK_LIB_NAME'] = '${LIBPREFIX}mapnik${LIBSUFFIX}' else: - env['MAPNIK_LIB_NAME'] = '${SHLIBPREFIX}mapnik2${SHLIBSUFFIX}' + env['MAPNIK_LIB_NAME'] = '${SHLIBPREFIX}mapnik${SHLIBSUFFIX}' if env['PKG_CONFIG_PATH']: env['ENV']['PKG_CONFIG_PATH'] = os.path.realpath(env['PKG_CONFIG_PATH']) @@ -1393,13 +1386,6 @@ if not preconfigured: common_cxx_flags = '-D%s -DBOOST_SPIRIT_THREADSAFE -DMAPNIK_THREADSAFE ' % env['PLATFORM'].upper() else : common_cxx_flags = '-D%s ' % env['PLATFORM'].upper() - - svn_version = call('svnversion') - if not svn_version == 'exported': - pattern = r'(\d+)(.*)' - try: - env['SVN_REVISION'] = re.match(pattern,svn_version).groups()[0] - except: pass # Mac OSX (Darwin) special settings if env['PLATFORM'] == 'Darwin': @@ -1682,7 +1668,7 @@ if not HELP_REQUESTED: # Install the python speed testing scripts if python bindings will be available SConscript('utils/performance/build.py') - # Install the mapnik2 upgrade script + # Install the mapnik upgrade script SConscript('utils/upgrade_map_xml/build.py') # Configure fonts and if requested install the bundled DejaVu fonts diff --git a/bindings/python/build.py b/bindings/python/build.py index 6deed738a..d46661231 100644 --- a/bindings/python/build.py +++ b/bindings/python/build.py @@ -40,12 +40,10 @@ def is_py3(): prefix = env['PREFIX'] -target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2') +target_path = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik') +target_path_deprecated = os.path.normpath(env['PYTHON_INSTALL_LOCATION'] + os.path.sep + 'mapnik2') -libraries = ['mapnik2','png'] - -if env['JPEG']: - libraries.append('jpeg') +libraries = ['mapnik'] if env['BOOST_PYTHON_LIB']: libraries.append(env['BOOST_PYTHON_LIB']) @@ -55,11 +53,16 @@ else: else: libraries.append('boost_python%s' % env['BOOST_APPEND']) +# TODO - do solaris/fedora need direct linking too? if env['PLATFORM'] == 'Darwin': - libraries.append(env['ICU_LIB_NAME']) - libraries.append('boost_regex%s' % env['BOOST_APPEND']) - if env['THREADING'] == 'multi': - libraries.append('boost_thread%s' % env['BOOST_APPEND']) + if not env['PYTHON_DYNAMIC_LOOKUP']: + libraries.append('png') + if env['JPEG']: + libraries.append('jpeg') + libraries.append(env['ICU_LIB_NAME']) + libraries.append('boost_regex%s' % env['BOOST_APPEND']) + if env['THREADING'] == 'multi': + libraries.append('boost_thread%s' % env['BOOST_APPEND']) ##### Python linking on OS X is tricky ### # Confounding problems are: @@ -105,6 +108,7 @@ if env['PLATFORM'] == 'Darwin': else: # TODO - do we need to pass -L/? python_link_flag = '-lpython%s' % env['PYTHON_VERSION'] + elif env['PLATFORM'] == 'SunOS': # make sure to explicitly link mapnik.so against # libmapnik in its installed location @@ -121,22 +125,28 @@ else: paths = ''' """Configuration paths of Mapnik fonts and input plugins (auto-generated by SCons).""" -import os +from os.path import normpath,join,dirname mapniklibpath = '%s' +mapniklibpath = normpath(join(dirname(__file__),mapniklibpath)) ''' -paths += "inputpluginspath = os.path.normpath(mapniklibpath + '/input')\n" +paths += "inputpluginspath = join(mapniklibpath,'input')\n" if env['SYSTEM_FONTS']: - paths += "fontscollectionpath = os.path.normpath('%s')" % env['SYSTEM_FONTS'] + paths += "fontscollectionpath = normpath('%s')\n" % env['SYSTEM_FONTS'] else: - paths += "fontscollectionpath = os.path.normpath(mapniklibpath + '/fonts')" + paths += "fontscollectionpath = join(mapniklibpath,'fonts')\n" +paths += "__all__ = [mapniklibpath,inputpluginspath,fontscollectionpath]\n" if not os.path.exists('mapnik'): os.mkdir('mapnik') -file('mapnik/paths.py','w').write(paths % (env['MAPNIK_LIB_DIR'])) + +if hasattr(os.path,'relpath'): # python 2.6 and above + file('mapnik/paths.py','w').write(paths % (os.path.relpath(env['MAPNIK_LIB_DIR'],target_path))) +else: + file('mapnik/paths.py','w').write(paths % (env['MAPNIK_LIB_DIR'])) # force open perms temporarily so that `sudo scons install` # does not later break simple non-install non-sudo rebuild @@ -151,7 +161,10 @@ if 'install' in COMMAND_LINE_TARGETS: init_files.remove('mapnik/paths.py') init_module = env.Install(target_path, init_files) env.Alias(target='install', source=init_module) - + # install mapnik2 module which redirects to mapnik and issues DeprecatedWarning + init_mapnik2 = env.Install(target_path_deprecated, 'mapnik2/__init__.py') + env.Alias(target='install', source=init_mapnik2) + # fix perms and install the custom generated 'paths.py' if 'install' in COMMAND_LINE_TARGETS: targetp = os.path.join(target_path,'paths.py') @@ -163,18 +176,11 @@ if 'install' in COMMAND_LINE_TARGETS: Copy("$TARGET","$SOURCE"), Chmod("$TARGET", 0644), ]) + -# install the ogcserver module code -if 'install' in COMMAND_LINE_TARGETS: - ogcserver_files = glob.glob('mapnik/ogcserver/*.py') - ogcserver_module = env.Install(target_path + '/ogcserver', ogcserver_files) - env.Alias(target='install', source=ogcserver_module) - - # install the shared object beside the module directory sources = glob.glob('*.cpp') - py_env = env.Clone() py_env.Append(CPPPATH = env['PYTHON_INCLUDES']) @@ -188,13 +194,8 @@ if env['HAS_PYCAIRO']: py_env.ParseConfig('pkg-config --cflags pycairo') py_env.Append(CXXFLAGS = '-DHAVE_PYCAIRO') -if env['SVN_REVISION']: - sources.remove('mapnik_python.cpp') - env2 = py_env.Clone() - env2.Append(CXXFLAGS='-DSVN_REVISION=%s' % env['SVN_REVISION']) - sources.insert(0,env2.SharedObject('mapnik_python.cpp')) - -_mapnik = py_env.LoadableModule('mapnik/_mapnik2', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags) +libraries.append('boost_thread%s' % env['BOOST_APPEND']) +_mapnik = py_env.LoadableModule('mapnik/_mapnik', sources, LIBS=libraries, LDMODULEPREFIX='', LDMODULESUFFIX='.so',LINKFLAGS=linkflags) Depends(_mapnik, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME'])) @@ -213,4 +214,5 @@ if 'uninstall' not in COMMAND_LINE_TARGETS: env['create_uninstall_target'](env, target_path) - \ No newline at end of file +env['create_uninstall_target'](env, target_path_deprecated) + diff --git a/bindings/python/mapnik/__init__.py b/bindings/python/mapnik/__init__.py index 6eac1d6d9..4364f7b45 100644 --- a/bindings/python/mapnik/__init__.py +++ b/bindings/python/mapnik/__init__.py @@ -43,7 +43,7 @@ import os import sys import warnings -from _mapnik2 import * +from _mapnik import * from paths import inputpluginspath, fontscollectionpath import printing @@ -630,106 +630,4 @@ def register_fonts(path=fontscollectionpath,valid_extensions=['.ttf','.otf','.tt # auto-register known plugins and fonts register_plugins() -register_fonts() - -# Explicitly export API members to avoid namespace pollution -# and ensure correct documentation processing -__all__ = [ - # classes - 'Color', - 'Coord', - 'Palette', - #'ColorBand', - 'CompositeOp', - 'DatasourceCache', - 'MemoryDatasource', - 'Box2d', - 'Feature', - 'Featureset', - 'FontEngine', - 'Geometry2d', - 'GlyphSymbolizer', - 'Image', - 'ImageView', - 'Grid', - 'GridView', - 'Layer', - 'Layers', - 'LinePatternSymbolizer', - 'LineSymbolizer', - 'Map', - 'MarkersSymbolizer', - 'Names', - 'Path', - 'Parameter', - 'Parameters', - 'PointDatasource', - 'PointSymbolizer', - 'PolygonPatternSymbolizer', - 'PolygonSymbolizer', - 'ProjTransform', - 'Projection', - 'Query', - 'RasterSymbolizer', - 'RasterColorizer', - 'Rule', 'Rules', - 'ShieldSymbolizer', - 'Singleton', - 'Stroke', - 'Style', - 'Symbolizer', - 'Symbolizers', - 'TextSymbolizer', - 'ViewTransform', - # enums - 'aspect_fix_mode', - 'point_placement', - 'label_placement', - 'line_cap', - 'line_join', - 'text_transform', - 'vertical_alignment', - 'horizontal_alignment', - 'justify_alignment', - 'pattern_alignment', - 'filter_mode', - # functions - # datasources - 'Datasource', - 'CreateDatasource', - 'Shapefile', - 'PostGIS', - 'Raster', - 'Gdal', - 'Occi', - 'Ogr', - 'SQLite', - 'Osm', - 'Kismet', - 'Describe', - # version and environment - 'mapnik_version_string', - 'mapnik_version', - 'mapnik_svn_revision', - 'has_cairo', - 'has_pycairo', - # factory methods - 'Expression', - 'PathExpression', - # load/save/render - 'load_map', - 'load_map_from_string', - 'save_map', - 'save_map_to_string', - 'render', - 'render_grid', - 'render_tile_to_file', - 'render_to_file', - # other - 'register_plugins', - 'register_fonts', - 'scale_denominator', - # deprecated - 'Filter', - 'Envelope', - ] +register_fonts() \ No newline at end of file diff --git a/bindings/python/mapnik/printing.py b/bindings/python/mapnik/printing.py index db6f6a139..58f18b653 100644 --- a/bindings/python/mapnik/printing.py +++ b/bindings/python/mapnik/printing.py @@ -4,15 +4,15 @@ basic usage is along the lines of -import mapnik2 +import mapnik -page = mapnik2.printing.PDFPrinter() -m = mapnik2.Map(100,100) -mapnik2.load_map(m, "my_xml_map_description", True) +page = mapnik.printing.PDFPrinter() +m = mapnik.Map(100,100) +mapnik.load_map(m, "my_xml_map_description", True) m.zoom_all() page.render_map(m,"my_output_file.pdf") -see the documentation of mapnik2.printing.PDFPrinter() for options +see the documentation of mapnik.printing.PDFPrinter() for options """ from __future__ import absolute_import diff --git a/bindings/python/mapnik_featureset.cpp b/bindings/python/mapnik_featureset.cpp index 84e04f6e6..fe4a8c885 100644 --- a/bindings/python/mapnik_featureset.cpp +++ b/bindings/python/mapnik_featureset.cpp @@ -71,15 +71,15 @@ void export_featureset() .def("__iter__",pass_through) .def("next",next) .add_property("features",features, - "The list of features.\n" - "\n" - "Usage:\n" - ">>> m.query_map_point(0, 10, 10)\n" - "\n" - ">>> fs = m.query_map_point(0, 10, 10)\n" - ">>> for f in fs.features:\n" - ">>> print f\n" - "\n" + "The list of features.\n" + "\n" + "Usage:\n" + ">>> m.query_map_point(0, 10, 10)\n" + "\n" + ">>> fs = m.query_map_point(0, 10, 10)\n" + ">>> for f in fs.features:\n" + ">>> print f\n" + "\n" ) ; } diff --git a/bindings/python/mapnik_python.cpp b/bindings/python/mapnik_python.cpp index 9d36aebc6..dc76aef54 100644 --- a/bindings/python/mapnik_python.cpp +++ b/bindings/python/mapnik_python.cpp @@ -319,15 +319,6 @@ unsigned mapnik_version() return MAPNIK_VERSION; } -unsigned mapnik_svn_revision() -{ -#if defined(SVN_REVISION) - return SVN_REVISION; -#else - return 0; -#endif -} - // indicator for jpeg read/write support within libmapnik bool has_jpeg() { @@ -375,7 +366,7 @@ BOOST_PYTHON_FUNCTION_OVERLOADS(save_map_overloads, save_map, 2, 3) BOOST_PYTHON_FUNCTION_OVERLOADS(save_map_to_string_overloads, save_map_to_string, 1, 2) BOOST_PYTHON_FUNCTION_OVERLOADS(render_overloads, render, 2, 5) -BOOST_PYTHON_MODULE(_mapnik2) +BOOST_PYTHON_MODULE(_mapnik) { using namespace boost::python; @@ -606,7 +597,6 @@ BOOST_PYTHON_MODULE(_mapnik2) def("save_map_to_string", &save_map_to_string, save_map_to_string_overloads()); def("mapnik_version", &mapnik_version,"Get the Mapnik version number"); - def("mapnik_svn_revision", &mapnik_svn_revision,"Get the Mapnik svn revision"); def("has_jpeg", &has_jpeg, "Get jpeg read/write support status"); def("has_cairo", &has_cairo, "Get cairo library status"); def("has_pycairo", &has_pycairo, "Get pycairo module status"); diff --git a/bindings/python/mapnik_raster_colorizer.cpp b/bindings/python/mapnik_raster_colorizer.cpp index ee19c5123..b628a6309 100644 --- a/bindings/python/mapnik_raster_colorizer.cpp +++ b/bindings/python/mapnik_raster_colorizer.cpp @@ -105,51 +105,51 @@ void export_raster_colorizer() ">>> colorizer.add_stop(stop)\n" ) .def("add_stop", add_stop2, - (arg("value")), - "Add a colorizer stop to the raster colorizer, using the default mode and color.\n" - "\n" - "Usage:\n" - ">>> default_color = mapnik.Color(\"#0044cc\")\n" - ">>> colorizer = mapnik.RasterColorizer(mapnik2.COLORIZER_LINEAR, default_color)\n" - ">>> colorizer.add_stop(100)\n" + (arg("value")), + "Add a colorizer stop to the raster colorizer, using the default mode and color.\n" + "\n" + "Usage:\n" + ">>> default_color = mapnik.Color(\"#0044cc\")\n" + ">>> colorizer = mapnik.RasterColorizer(mapnik.COLORIZER_LINEAR, default_color)\n" + ">>> colorizer.add_stop(100)\n" ) .def("add_stop", add_stop3, - (arg("value")), - "Add a colorizer stop to the raster colorizer, using the default mode.\n" - "\n" - "Usage:\n" - ">>> default_color = mapnik.Color(\"#0044cc\")\n" - ">>> colorizer = mapnik.RasterColorizer(mapnik2.COLORIZER_LINEAR, default_color)\n" - ">>> colorizer.add_stop(100, mapnik.Color(\"#123456\"))\n" + (arg("value")), + "Add a colorizer stop to the raster colorizer, using the default mode.\n" + "\n" + "Usage:\n" + ">>> default_color = mapnik.Color(\"#0044cc\")\n" + ">>> colorizer = mapnik.RasterColorizer(mapnik.COLORIZER_LINEAR, default_color)\n" + ">>> colorizer.add_stop(100, mapnik.Color(\"#123456\"))\n" ) .def("add_stop", add_stop4, - (arg("value")), - "Add a colorizer stop to the raster colorizer, using the default color.\n" - "\n" - "Usage:\n" - ">>> default_color = mapnik.Color(\"#0044cc\")\n" - ">>> colorizer = mapnik.RasterColorizer(mapnik2.COLORIZER_LINEAR, default_color)\n" - ">>> colorizer.add_stop(100, mapnik2.COLORIZER_EXACT)\n" + (arg("value")), + "Add a colorizer stop to the raster colorizer, using the default color.\n" + "\n" + "Usage:\n" + ">>> default_color = mapnik.Color(\"#0044cc\")\n" + ">>> colorizer = mapnik.RasterColorizer(mapnik.COLORIZER_LINEAR, default_color)\n" + ">>> colorizer.add_stop(100, mapnik.COLORIZER_EXACT)\n" ) .def("add_stop", add_stop5, - (arg("value")), - "Add a colorizer stop to the raster colorizer.\n" - "\n" - "Usage:\n" - ">>> default_color = mapnik.Color(\"#0044cc\")\n" - ">>> colorizer = mapnik.RasterColorizer(mapnik2.COLORIZER_LINEAR, default_color)\n" - ">>> colorizer.add_stop(100, mapnik.COLORIZER_DISCRETE, mapnik.Color(\"#112233\"))\n" + (arg("value")), + "Add a colorizer stop to the raster colorizer.\n" + "\n" + "Usage:\n" + ">>> default_color = mapnik.Color(\"#0044cc\")\n" + ">>> colorizer = mapnik.RasterColorizer(mapnik.COLORIZER_LINEAR, default_color)\n" + ">>> colorizer.add_stop(100, mapnik.COLORIZER_DISCRETE, mapnik.Color(\"#112233\"))\n" ) - .def("get_color", &raster_colorizer::get_color, - "Get the color assigned to a certain value in raster data.\n" - "\n" - "Usage:\n" - ">>> colorizer = mapnik.RasterColorizer()\n" - ">>> color = mapnik.Color(\"#0044cc\")\n" - ">>> colorizer.add_stop(0, mapnik2.COLORIZER_DISCRETE, mapnik.Color(\"#000000\"))\n" - ">>> colorizer.add_stop(100, mapnik2.COLORIZER_DISCRETE, mapnik.Color(\"#0E0A06\"))\n" - ">>> colorizer.get_color(50)\n" - "Color('#070503')\n" + .def("get_color", &raster_colorizer::get_color, + "Get the color assigned to a certain value in raster data.\n" + "\n" + "Usage:\n" + ">>> colorizer = mapnik.RasterColorizer()\n" + ">>> color = mapnik.Color(\"#0044cc\")\n" + ">>> colorizer.add_stop(0, mapnik.COLORIZER_DISCRETE, mapnik.Color(\"#000000\"))\n" + ">>> colorizer.add_stop(100, mapnik.COLORIZER_DISCRETE, mapnik.Color(\"#0E0A06\"))\n" + ">>> colorizer.get_color(50)\n" + "Color('#070503')\n" ) ; diff --git a/bindings/python/mapnik_style.cpp b/bindings/python/mapnik_style.cpp index e8109d7da..42d1c8eac 100644 --- a/bindings/python/mapnik_style.cpp +++ b/bindings/python/mapnik_style.cpp @@ -95,9 +95,9 @@ void export_style() "Usage:\n" ">>> for r in m.find_style('style 1').rules:\n" ">>> print r\n" - "\n" - "\n" - ) + "\n" + "\n" + ) .add_property("filter_mode", &feature_type_style::get_filter_mode, &feature_type_style::set_filter_mode, diff --git a/demo/c++/build.py b/demo/c++/build.py index f08772e9f..a9b87265c 100644 --- a/demo/c++/build.py +++ b/demo/c++/build.py @@ -41,7 +41,7 @@ if env['HAS_CAIRO']: libraries = copy(env['LIBMAPNIK_LIBS']) boost_program_options = 'boost_program_options%s' % env['BOOST_APPEND'] -libraries.extend([boost_program_options,'mapnik2']) +libraries.extend([boost_program_options,'mapnik']) rundemo = demo_env.Program('rundemo', source, LIBS=libraries, LINKFLAGS=env["CUSTOM_LDFLAGS"]) @@ -50,4 +50,4 @@ Depends(rundemo, env.subst('../../src/%s' % env['MAPNIK_LIB_NAME'])) # we don't install this app because the datasource paths are relative # and we're not going to install the sample data. #env.Install(install_prefix + '/bin', rundemo) -#env.Alias('install', install_prefix + '/bin') \ No newline at end of file +#env.Alias('install', install_prefix + '/bin') diff --git a/demo/c++/rundemo.cpp b/demo/c++/rundemo.cpp index 4216dd677..b0dbe9d09 100644 --- a/demo/c++/rundemo.cpp +++ b/demo/c++/rundemo.cpp @@ -43,7 +43,7 @@ int main ( int argc , char** argv) { if (argc != 2) { - std::cout << "usage: ./rundemo \nUsually /usr/local/lib/mapnik2\n"; + std::cout << "usage: ./rundemo \nUsually /usr/local/lib/mapnik\n"; std::cout << "Warning: ./rundemo looks for data in ../data/,\nTherefore must be run from within the demo/c++ folder.\n"; return EXIT_SUCCESS; } diff --git a/demo/python/rundemo.py b/demo/python/rundemo.py index 35fac6b83..d35935c79 100644 --- a/demo/python/rundemo.py +++ b/demo/python/rundemo.py @@ -26,7 +26,7 @@ import sys try: - import mapnik2 + import mapnik except: print '\n\nThe mapnik library and python bindings must have been compiled and \ installed successfully before running this script.\n\n' @@ -41,11 +41,11 @@ except ImportError: # Instanciate a map, giving it a width and height. Remember: the word "map" is # reserved in Python! :) -m = mapnik2.Map(800,600,"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs") +m = mapnik.Map(800,600,"+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs") # Set its background colour. More on colours later ... -m.background = mapnik2.Color('white') +m.background = mapnik.Color('white') # Now we can start adding layers, in stacking order (i.e. bottom layer first) @@ -66,9 +66,9 @@ m.background = mapnik2.Color('white') # password='mypassword' # table= TODO -provpoly_lyr = mapnik2.Layer('Provinces') +provpoly_lyr = mapnik.Layer('Provinces') provpoly_lyr.srs = "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs" -provpoly_lyr.datasource = mapnik2.Shapefile(file='../data/boundaries', encoding='latin1') +provpoly_lyr.datasource = mapnik.Shapefile(file='../data/boundaries', encoding='latin1') # We then define a style for the layer. A layer can have one or many styles. # Styles are named, so they can be shared across different layers. @@ -78,18 +78,18 @@ provpoly_lyr.datasource = mapnik2.Shapefile(file='../data/boundaries', encoding= # multiple styles in one layer is the same has having multiple layers. # The paradigm is useful mostly as a convenience. -provpoly_style = mapnik2.Style() +provpoly_style = mapnik.Style() # A Style needs one or more rules. A rule will normally consist of a filter # for feature selection, and one or more symbolizers. -provpoly_rule_on = mapnik2.Rule() +provpoly_rule_on = mapnik.Rule() # A Expression() allows the selection of features to which the symbology will # be applied. More on Mapnik expressions can be found in Tutorial #2. # A given feature can only match one filter per rule per style. -provpoly_rule_on.filter = mapnik2.Expression("[NAME_EN] = 'Ontario'") +provpoly_rule_on.filter = mapnik.Expression("[NAME_EN] = 'Ontario'") # Here a symbolizer is defined. Available are: # - LineSymbolizer(Color(),) @@ -103,12 +103,12 @@ provpoly_rule_on.filter = mapnik2.Expression("[NAME_EN] = 'Ontario'") # - Color() where will be something like '#00FF00' # or '#0f0' or 'green' -provpoly_rule_on.symbols.append(mapnik2.PolygonSymbolizer(mapnik2.Color(250, 190, 183))) +provpoly_rule_on.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color(250, 190, 183))) provpoly_style.rules.append(provpoly_rule_on) -provpoly_rule_qc = mapnik2.Rule() -provpoly_rule_qc.filter = mapnik2.Expression("[NOM_FR] = 'Québec'") -provpoly_rule_qc.symbols.append(mapnik2.PolygonSymbolizer(mapnik2.Color(217, 235, 203))) +provpoly_rule_qc = mapnik.Rule() +provpoly_rule_qc.filter = mapnik.Expression("[NOM_FR] = 'Québec'") +provpoly_rule_qc.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color(217, 235, 203))) provpoly_style.rules.append(provpoly_rule_qc) # Add the style to the map, giving it a name. This is the name that will be @@ -131,14 +131,14 @@ m.layers.append(provpoly_lyr) # A simple example ... -qcdrain_lyr = mapnik2.Layer('Quebec Hydrography') +qcdrain_lyr = mapnik.Layer('Quebec Hydrography') qcdrain_lyr.srs = "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs" -qcdrain_lyr.datasource = mapnik2.Shapefile(file='../data/qcdrainage') +qcdrain_lyr.datasource = mapnik.Shapefile(file='../data/qcdrainage') -qcdrain_style = mapnik2.Style() -qcdrain_rule = mapnik2.Rule() -qcdrain_rule.filter = mapnik2.Expression('[HYC] = 8') -qcdrain_rule.symbols.append(mapnik2.PolygonSymbolizer(mapnik2.Color(153, 204, 255))) +qcdrain_style = mapnik.Style() +qcdrain_rule = mapnik.Rule() +qcdrain_rule.filter = mapnik.Expression('[HYC] = 8') +qcdrain_rule.symbols.append(mapnik.PolygonSymbolizer(mapnik.Color(153, 204, 255))) qcdrain_style.rules.append(qcdrain_rule) m.append_style('drainage', qcdrain_style) @@ -149,31 +149,31 @@ m.layers.append(qcdrain_lyr) # attributes, and same desired style), so we're going to # re-use the style defined in the above layer for the next one. -ondrain_lyr = mapnik2.Layer('Ontario Hydrography') +ondrain_lyr = mapnik.Layer('Ontario Hydrography') ondrain_lyr.srs = "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs" -ondrain_lyr.datasource = mapnik2.Shapefile(file='../data/ontdrainage') +ondrain_lyr.datasource = mapnik.Shapefile(file='../data/ontdrainage') ondrain_lyr.styles.append('drainage') m.layers.append(ondrain_lyr) # Provincial boundaries -provlines_lyr = mapnik2.Layer('Provincial borders') +provlines_lyr = mapnik.Layer('Provincial borders') provlines_lyr.srs = "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs" -provlines_lyr.datasource = mapnik2.Shapefile(file='../data/boundaries_l') +provlines_lyr.datasource = mapnik.Shapefile(file='../data/boundaries_l') # Here we define a "dash dot dot dash" pattern for the provincial boundaries. -provlines_stk = mapnik2.Stroke() +provlines_stk = mapnik.Stroke() provlines_stk.add_dash(8, 4) provlines_stk.add_dash(2, 2) provlines_stk.add_dash(2, 2) -provlines_stk.color = mapnik2.Color('black') +provlines_stk.color = mapnik.Color('black') provlines_stk.width = 1.0 -provlines_style = mapnik2.Style() -provlines_rule = mapnik2.Rule() -provlines_rule.symbols.append(mapnik2.LineSymbolizer(provlines_stk)) +provlines_style = mapnik.Style() +provlines_rule = mapnik.Rule() +provlines_rule.symbols.append(mapnik.LineSymbolizer(provlines_stk)) provlines_style.rules.append(provlines_rule) m.append_style('provlines', provlines_style) @@ -182,22 +182,22 @@ m.layers.append(provlines_lyr) # Roads 3 and 4 (The "grey" roads) -roads34_lyr = mapnik2.Layer('Roads') +roads34_lyr = mapnik.Layer('Roads') roads34_lyr.srs = "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs" # create roads datasource (we're going to re-use it later) -roads34_lyr.datasource = mapnik2.Shapefile(file='../data/roads') +roads34_lyr.datasource = mapnik.Shapefile(file='../data/roads') -roads34_style = mapnik2.Style() -roads34_rule = mapnik2.Rule() -roads34_rule.filter = mapnik2.Expression('([CLASS] = 3) or ([CLASS] = 4)') +roads34_style = mapnik.Style() +roads34_rule = mapnik.Rule() +roads34_rule.filter = mapnik.Expression('([CLASS] = 3) or ([CLASS] = 4)') # With lines of a certain width, you can control how the ends # are closed off using line_cap as below. -roads34_rule_stk = mapnik2.Stroke() -roads34_rule_stk.color = mapnik2.Color(171,158,137) -roads34_rule_stk.line_cap = mapnik2.line_cap.ROUND_CAP +roads34_rule_stk = mapnik.Stroke() +roads34_rule_stk.color = mapnik.Color(171,158,137) +roads34_rule_stk.line_cap = mapnik.line_cap.ROUND_CAP # Available options are: # line_cap: BUTT_CAP, SQUARE_CAP, ROUND_CAP @@ -207,7 +207,7 @@ roads34_rule_stk.line_cap = mapnik2.line_cap.ROUND_CAP # can be set to a numerical value. roads34_rule_stk.width = 2.0 -roads34_rule.symbols.append(mapnik2.LineSymbolizer(roads34_rule_stk)) +roads34_rule.symbols.append(mapnik.LineSymbolizer(roads34_rule_stk)) roads34_style.rules.append(roads34_rule) m.append_style('smallroads', roads34_style) @@ -216,31 +216,31 @@ m.layers.append(roads34_lyr) # Roads 2 (The thin yellow ones) -roads2_lyr = mapnik2.Layer('Roads') +roads2_lyr = mapnik.Layer('Roads') roads2_lyr.srs = "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs" # Just get a copy from roads34_lyr roads2_lyr.datasource = roads34_lyr.datasource -roads2_style_1 = mapnik2.Style() -roads2_rule_1 = mapnik2.Rule() -roads2_rule_1.filter = mapnik2.Expression('[CLASS] = 2') -roads2_rule_stk_1 = mapnik2.Stroke() -roads2_rule_stk_1.color = mapnik2.Color(171,158,137) -roads2_rule_stk_1.line_cap = mapnik2.line_cap.ROUND_CAP +roads2_style_1 = mapnik.Style() +roads2_rule_1 = mapnik.Rule() +roads2_rule_1.filter = mapnik.Expression('[CLASS] = 2') +roads2_rule_stk_1 = mapnik.Stroke() +roads2_rule_stk_1.color = mapnik.Color(171,158,137) +roads2_rule_stk_1.line_cap = mapnik.line_cap.ROUND_CAP roads2_rule_stk_1.width = 4.0 -roads2_rule_1.symbols.append(mapnik2.LineSymbolizer(roads2_rule_stk_1)) +roads2_rule_1.symbols.append(mapnik.LineSymbolizer(roads2_rule_stk_1)) roads2_style_1.rules.append(roads2_rule_1) m.append_style('road-border', roads2_style_1) -roads2_style_2 = mapnik2.Style() -roads2_rule_2 = mapnik2.Rule() -roads2_rule_2.filter = mapnik2.Expression('[CLASS] = 2') -roads2_rule_stk_2 = mapnik2.Stroke() -roads2_rule_stk_2.color = mapnik2.Color(255,250,115) -roads2_rule_stk_2.line_cap = mapnik2.line_cap.ROUND_CAP +roads2_style_2 = mapnik.Style() +roads2_rule_2 = mapnik.Rule() +roads2_rule_2.filter = mapnik.Expression('[CLASS] = 2') +roads2_rule_stk_2 = mapnik.Stroke() +roads2_rule_stk_2.color = mapnik.Color(255,250,115) +roads2_rule_stk_2.line_cap = mapnik.line_cap.ROUND_CAP roads2_rule_stk_2.width = 2.0 -roads2_rule_2.symbols.append(mapnik2.LineSymbolizer(roads2_rule_stk_2)) +roads2_rule_2.symbols.append(mapnik.LineSymbolizer(roads2_rule_stk_2)) roads2_style_2.rules.append(roads2_rule_2) m.append_style('road-fill', roads2_style_2) @@ -252,29 +252,29 @@ m.layers.append(roads2_lyr) # Roads 1 (The big orange ones, the highways) -roads1_lyr = mapnik2.Layer('Roads') +roads1_lyr = mapnik.Layer('Roads') roads1_lyr.srs = "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs" roads1_lyr.datasource = roads34_lyr.datasource -roads1_style_1 = mapnik2.Style() -roads1_rule_1 = mapnik2.Rule() -roads1_rule_1.filter = mapnik2.Expression('[CLASS] = 1') -roads1_rule_stk_1 = mapnik2.Stroke() -roads1_rule_stk_1.color = mapnik2.Color(188,149,28) -roads1_rule_stk_1.line_cap = mapnik2.line_cap.ROUND_CAP +roads1_style_1 = mapnik.Style() +roads1_rule_1 = mapnik.Rule() +roads1_rule_1.filter = mapnik.Expression('[CLASS] = 1') +roads1_rule_stk_1 = mapnik.Stroke() +roads1_rule_stk_1.color = mapnik.Color(188,149,28) +roads1_rule_stk_1.line_cap = mapnik.line_cap.ROUND_CAP roads1_rule_stk_1.width = 7.0 -roads1_rule_1.symbols.append(mapnik2.LineSymbolizer(roads1_rule_stk_1)) +roads1_rule_1.symbols.append(mapnik.LineSymbolizer(roads1_rule_stk_1)) roads1_style_1.rules.append(roads1_rule_1) m.append_style('highway-border', roads1_style_1) -roads1_style_2 = mapnik2.Style() -roads1_rule_2 = mapnik2.Rule() -roads1_rule_2.filter = mapnik2.Expression('[CLASS] = 1') -roads1_rule_stk_2 = mapnik2.Stroke() -roads1_rule_stk_2.color = mapnik2.Color(242,191,36) -roads1_rule_stk_2.line_cap = mapnik2.line_cap.ROUND_CAP +roads1_style_2 = mapnik.Style() +roads1_rule_2 = mapnik.Rule() +roads1_rule_2.filter = mapnik.Expression('[CLASS] = 1') +roads1_rule_stk_2 = mapnik.Stroke() +roads1_rule_stk_2.color = mapnik.Color(242,191,36) +roads1_rule_stk_2.line_cap = mapnik.line_cap.ROUND_CAP roads1_rule_stk_2.width = 5.0 -roads1_rule_2.symbols.append(mapnik2.LineSymbolizer(roads1_rule_stk_2)) +roads1_rule_2.symbols.append(mapnik.LineSymbolizer(roads1_rule_stk_2)) roads1_style_2.rules.append(roads1_rule_2) m.append_style('highway-fill', roads1_style_2) @@ -286,25 +286,25 @@ m.layers.append(roads1_lyr) # Populated Places -popplaces_lyr = mapnik2.Layer('Populated Places') +popplaces_lyr = mapnik.Layer('Populated Places') popplaces_lyr.srs = "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat+1=49 +lat_2=77 +datum=NAD83 +units=m +no_defs" -popplaces_lyr.datasource = mapnik2.Shapefile(file='../data/popplaces',encoding='latin1') +popplaces_lyr.datasource = mapnik.Shapefile(file='../data/popplaces',encoding='latin1') -popplaces_style = mapnik2.Style() -popplaces_rule = mapnik2.Rule() +popplaces_style = mapnik.Style() +popplaces_rule = mapnik.Rule() # And here we have a TextSymbolizer, used for labeling. # The first parameter is the name of the attribute to use as the source of the # text to label with. Then there is font size in points (I think?), and colour. -popplaces_text_symbolizer = mapnik2.TextSymbolizer(mapnik2.Expression("[GEONAME]"), +popplaces_text_symbolizer = mapnik.TextSymbolizer(mapnik.Expression("[GEONAME]"), 'DejaVu Sans Book', - 10, mapnik2.Color('black')) + 10, mapnik.Color('black')) # We set a "halo" around the text, which looks like an outline if thin enough, # or an outright background if large enough. -popplaces_text_symbolizer.label_placement= mapnik2.label_placement.POINT_PLACEMENT -popplaces_text_symbolizer.halo_fill = mapnik2.Color('white') +popplaces_text_symbolizer.label_placement= mapnik.label_placement.POINT_PLACEMENT +popplaces_text_symbolizer.halo_fill = mapnik.Color('white') popplaces_text_symbolizer.halo_radius = 1 popplaces_text_symbolizer.avoid_edges = True #popplaces_text_symbolizer.minimum_padding = 30 @@ -320,11 +320,11 @@ m.layers.append(popplaces_lyr) # Draw map # Set the initial extent of the map in 'master' spherical Mercator projection -m.zoom_to_box(mapnik2.Box2d(-8024477.28459,5445190.38849,-7381388.20071,5662941.44855)) +m.zoom_to_box(mapnik.Box2d(-8024477.28459,5445190.38849,-7381388.20071,5662941.44855)) # Render two maps, two PNGs, one JPEG. -im = mapnik2.Image(m.width,m.height) -mapnik2.render(m, im) +im = mapnik.Image(m.width,m.height) +mapnik.render(m, im) # Save image to files images_ = [] @@ -348,37 +348,37 @@ im.save('demo_low.jpg', 'jpeg50') images_.append('demo_low.jpg') # Render cairo examples -if HAS_PYCAIRO_MODULE and mapnik2.has_pycairo(): +if HAS_PYCAIRO_MODULE and mapnik.has_pycairo(): svg_surface = cairo.SVGSurface('demo.svg', m.width,m.height) - mapnik2.render(m, svg_surface) + mapnik.render(m, svg_surface) svg_surface.finish() images_.append('demo.svg') pdf_surface = cairo.PDFSurface('demo.pdf', m.width,m.height) - mapnik2.render(m, pdf_surface) + mapnik.render(m, pdf_surface) images_.append('demo.pdf') pdf_surface.finish() postscript_surface = cairo.PSSurface('demo.ps', m.width,m.height) - mapnik2.render(m, postscript_surface) + mapnik.render(m, postscript_surface) images_.append('demo.ps') postscript_surface.finish() else: print '\n\nPycairo not available...', - if mapnik2.has_cairo(): + if mapnik.has_cairo(): print ' will render Cairo formats using alternative method' - mapnik2.render_to_file(m,'demo.pdf') + mapnik.render_to_file(m,'demo.pdf') images_.append('demo.pdf') - mapnik2.render_to_file(m,'demo.ps') + mapnik.render_to_file(m,'demo.ps') images_.append('demo.ps') - mapnik2.render_to_file(m,'demo.svg') + mapnik.render_to_file(m,'demo.svg') images_.append('demo.svg') - mapnik2.render_to_file(m,'demo_cairo_rgb.png','RGB24') + mapnik.render_to_file(m,'demo_cairo_rgb.png','RGB24') images_.append('demo_cairo_rgb.png') - mapnik2.render_to_file(m,'demo_cairo_argb.png','ARGB32') + mapnik.render_to_file(m,'demo_cairo_argb.png','ARGB32') images_.append('demo_cairo_argb.png') print "\n\n", len(images_), "maps have been rendered in the current directory:" @@ -388,4 +388,4 @@ for im_ in images_: print "\n\nHave a look!\n\n" -mapnik2.save_map(m,"map.xml") +mapnik.save_map(m,"map.xml") diff --git a/demo/viewer/build.py b/demo/viewer/build.py index ad30e7eb6..9db566370 100644 --- a/demo/viewer/build.py +++ b/demo/viewer/build.py @@ -23,7 +23,7 @@ Import ('env') import os import platform -lib_dir = os.path.normpath(env['DESTDIR'] + '/' + env['PREFIX'] + '/' + env['LIBDIR_SCHEMA'] + '/mapnik2') +lib_dir = os.path.normpath(env['DESTDIR'] + '/' + env['PREFIX'] + '/' + env['LIBDIR_SCHEMA'] + '/mapnik') fonts = 1 ini_template = ''' diff --git a/demo/viewer/main.cpp b/demo/viewer/main.cpp index d4b785f7b..ec9fcd557 100644 --- a/demo/viewer/main.cpp +++ b/demo/viewer/main.cpp @@ -43,7 +43,7 @@ int main( int argc, char **argv ) // register input plug-ins QString plugins_dir = settings.value("mapnik/plugins_dir", - QVariant("/usr/local/lib/mapnik2/input/")).toString(); + QVariant("/usr/local/lib/mapnik/input/")).toString(); datasource_cache::instance()->register_datasources(plugins_dir.toStdString()); // register fonts int count = settings.beginReadArray("mapnik/fonts"); diff --git a/demo/viewer/viewer.pro b/demo/viewer/viewer.pro index 681620ed3..538419e49 100644 --- a/demo/viewer/viewer.pro +++ b/demo/viewer/viewer.pro @@ -11,7 +11,7 @@ INCLUDEPATH += /usr/X11/include/freetype2 INCLUDEPATH += . QMAKE_CXXFLAGS +=' -DDARWIN -Wno-missing-field-initializers -ansi' -unix:LIBS = -L/usr/local/lib -L/usr/X11/lib -lmapnik2 -lfreetype +unix:LIBS = -L/usr/local/lib -L/usr/X11/lib -lmapnik -lfreetype unix:LIBS += -lboost_system -licuuc -lboost_filesystem -lboost_regex # Input diff --git a/plugins/input/gdal/build.py b/plugins/input/gdal/build.py index 2f81d98b1..137ddecb3 100644 --- a/plugins/input/gdal/build.py +++ b/plugins/input/gdal/build.py @@ -36,7 +36,7 @@ gdal_src = Split( plugin_env['LIBS'] = [env['PLUGINS']['gdal']['lib']] # Link Library to Dependencies -plugin_env['LIBS'].append('mapnik2') +plugin_env['LIBS'].append('mapnik') plugin_env['LIBS'].append(env['ICU_LIB_NAME']) if env['RUNTIME_LINK'] == 'static': @@ -45,7 +45,7 @@ if env['RUNTIME_LINK'] == 'static': input_plugin = plugin_env.SharedLibrary('../gdal', source=gdal_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LINKFLAGS=env['CUSTOM_LDFLAGS']) -# if the plugin links to libmapnik2 ensure it is built first +# if the plugin links to libmapnik ensure it is built first Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) if 'uninstall' not in COMMAND_LINE_TARGETS: diff --git a/plugins/input/geos/build.py b/plugins/input/geos/build.py index 490b5b69a..0fd8160e9 100644 --- a/plugins/input/geos/build.py +++ b/plugins/input/geos/build.py @@ -36,14 +36,14 @@ geos_src = Split( libraries = [env['PLUGINS']['geos']['lib']] # Link Library to Dependencies -libraries.append('mapnik2') +libraries.append('mapnik') libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../geos', source=geos_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -# if the plugin links to libmapnik2 ensure it is built first +# if the plugin links to libmapnik ensure it is built first Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) if 'uninstall' not in COMMAND_LINE_TARGETS: diff --git a/plugins/input/kismet/build.py b/plugins/input/kismet/build.py index 7a91069ab..5dfd68e01 100644 --- a/plugins/input/kismet/build.py +++ b/plugins/input/kismet/build.py @@ -34,13 +34,13 @@ kismet_src = Split( libraries = [] # Link Library to Dependencies -libraries.append('mapnik2') +libraries.append('mapnik') libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_thread%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../kismet', source=kismet_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -# if the plugin links to libmapnik2 ensure it is built first +# if the plugin links to libmapnik ensure it is built first Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) if 'uninstall' not in COMMAND_LINE_TARGETS: diff --git a/plugins/input/occi/build.py b/plugins/input/occi/build.py index b2c5f6c15..ed5d19729 100644 --- a/plugins/input/occi/build.py +++ b/plugins/input/occi/build.py @@ -36,12 +36,12 @@ occi_src = Split( ) libraries = [ 'occi', 'ociei' ] -libraries.append('mapnik2') +libraries.append('mapnik') libraries.append(env['ICU_LIB_NAME']) input_plugin = plugin_env.SharedLibrary('../occi', source=occi_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -# if the plugin links to libmapnik2 ensure it is built first +# if the plugin links to libmapnik ensure it is built first Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) if 'uninstall' not in COMMAND_LINE_TARGETS: diff --git a/plugins/input/ogr/build.py b/plugins/input/ogr/build.py index bcea67794..b79ffa2bf 100644 --- a/plugins/input/ogr/build.py +++ b/plugins/input/ogr/build.py @@ -38,7 +38,7 @@ ogr_src = Split( plugin_env['LIBS'] = [env['PLUGINS']['ogr']['lib']] # Link Library to Dependencies -plugin_env['LIBS'].append('mapnik2') +plugin_env['LIBS'].append('mapnik') plugin_env['LIBS'].append(env['ICU_LIB_NAME']) plugin_env['LIBS'].append('boost_system%s' % env['BOOST_APPEND']) plugin_env['LIBS'].append('boost_filesystem%s' % env['BOOST_APPEND']) @@ -56,7 +56,7 @@ if env.get('BOOST_LIB_VERSION_FROM_HEADER'): input_plugin = plugin_env.SharedLibrary('../ogr', source=ogr_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LINKFLAGS=env['CUSTOM_LDFLAGS']) -# if the plugin links to libmapnik2 ensure it is built first +# if the plugin links to libmapnik ensure it is built first Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) if 'uninstall' not in COMMAND_LINE_TARGETS: diff --git a/plugins/input/osm/build.py b/plugins/input/osm/build.py index 5fafc4d4e..b552b8048 100644 --- a/plugins/input/osm/build.py +++ b/plugins/input/osm/build.py @@ -38,12 +38,12 @@ osm_src = Split( libraries = [ 'xml2' ] libraries.append('curl') -libraries.append('mapnik2') +libraries.append('mapnik') libraries.append(env['ICU_LIB_NAME']) input_plugin = plugin_env.SharedLibrary('../osm', source=osm_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -# if the plugin links to libmapnik2 ensure it is built first +# if the plugin links to libmapnik ensure it is built first Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) if 'uninstall' not in COMMAND_LINE_TARGETS: diff --git a/plugins/input/postgis/build.py b/plugins/input/postgis/build.py index 5694fe1f0..f9961b564 100644 --- a/plugins/input/postgis/build.py +++ b/plugins/input/postgis/build.py @@ -35,14 +35,14 @@ postgis_src = Split( libraries = ['pq'] # Link Library to Dependencies -libraries.append('mapnik2') +libraries.append('mapnik') libraries.append(env['ICU_LIB_NAME']) if env['THREADING'] == 'multi': libraries.append('boost_thread%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../postgis', source=postgis_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -# if the plugin links to libmapnik2 ensure it is built first +# if the plugin links to libmapnik ensure it is built first Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) if 'uninstall' not in COMMAND_LINE_TARGETS: diff --git a/plugins/input/raster/build.py b/plugins/input/raster/build.py index 270509f40..f6c7f9d8a 100644 --- a/plugins/input/raster/build.py +++ b/plugins/input/raster/build.py @@ -35,14 +35,14 @@ raster_src = Split( libraries = [] # Link Library to Dependencies -libraries.append('mapnik2') +libraries.append('mapnik') libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../raster', source=raster_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -# if the plugin links to libmapnik2 ensure it is built first +# if the plugin links to libmapnik ensure it is built first Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) if 'uninstall' not in COMMAND_LINE_TARGETS: diff --git a/plugins/input/rasterlite/build.py b/plugins/input/rasterlite/build.py index 1046fa985..56e77d52b 100644 --- a/plugins/input/rasterlite/build.py +++ b/plugins/input/rasterlite/build.py @@ -35,14 +35,14 @@ rasterlite_src = Split( libraries = [env['PLUGINS']['rasterlite']['lib']] # Link Library to Dependencies -libraries.append('mapnik2') +libraries.append('mapnik') libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../rasterlite', source=rasterlite_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -# if the plugin links to libmapnik2 ensure it is built first +# if the plugin links to libmapnik ensure it is built first Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) if 'uninstall' not in COMMAND_LINE_TARGETS: diff --git a/plugins/input/shape/build.py b/plugins/input/shape/build.py index 81635f556..3f1a94421 100644 --- a/plugins/input/shape/build.py +++ b/plugins/input/shape/build.py @@ -39,7 +39,7 @@ shape_src = Split( libraries = [] # Link Library to Dependencies -libraries.append('mapnik2') +libraries.append('mapnik') libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) @@ -56,7 +56,7 @@ if env.get('BOOST_LIB_VERSION_FROM_HEADER'): input_plugin = plugin_env.SharedLibrary('../shape', SHLIBSUFFIX='.input', source=shape_src, SHLIBPREFIX='', LIBS = libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -# if the plugin links to libmapnik2 ensure it is built first +# if the plugin links to libmapnik ensure it is built first Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) if 'uninstall' not in COMMAND_LINE_TARGETS: diff --git a/plugins/input/sqlite/build.py b/plugins/input/sqlite/build.py index 41a701c80..5c53210cf 100644 --- a/plugins/input/sqlite/build.py +++ b/plugins/input/sqlite/build.py @@ -35,14 +35,14 @@ sqlite_src = Split( libraries = [ 'sqlite3' ] # Link Library to Dependencies -libraries.append('mapnik2') +libraries.append('mapnik') libraries.append(env['ICU_LIB_NAME']) libraries.append('boost_system%s' % env['BOOST_APPEND']) libraries.append('boost_filesystem%s' % env['BOOST_APPEND']) input_plugin = plugin_env.SharedLibrary('../sqlite', source=sqlite_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) -# if the plugin links to libmapnik2 ensure it is built first +# if the plugin links to libmapnik ensure it is built first Depends(input_plugin, env.subst('../../../src/%s' % env['MAPNIK_LIB_NAME'])) if 'uninstall' not in COMMAND_LINE_TARGETS: diff --git a/plugins/input/sqlite/sqlite_types.hpp b/plugins/input/sqlite/sqlite_types.hpp index e73e76b29..80e0b4539 100644 --- a/plugins/input/sqlite/sqlite_types.hpp +++ b/plugins/input/sqlite/sqlite_types.hpp @@ -148,10 +148,10 @@ public: // shared cache flag not available until >= 3.6.18 mode |= SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_SHAREDCACHE; #endif - const int rc = sqlite3_open_v2 (file_.c_str(), &db_, mode, 0); + const int rc = sqlite3_open_v2 (file.c_str(), &db_, mode, 0); #else #warning "Mapnik's sqlite plugin is compiling against a version of sqlite older than 3.5.x which may make rendering slow..." - const int rc = sqlite3_open (file_.c_str(), &db_); + const int rc = sqlite3_open (file.c_str(), &db_); #endif if (rc != SQLITE_OK) { diff --git a/plugins/input/templates/helloworld/README b/plugins/input/templates/helloworld/README index 51483d65a..90fbd736f 100644 --- a/plugins/input/templates/helloworld/README +++ b/plugins/input/templates/helloworld/README @@ -31,7 +31,7 @@ the middle of any map tile and display a "hello world!" label if used like: Or used in python like: -from mapnik2 import * +from mapnik import * m = Map(600,400) m.background = Color('white') s = Style() diff --git a/plugins/input/templates/helloworld/build.py b/plugins/input/templates/helloworld/build.py index 88c09a3fd..c11faa76b 100644 --- a/plugins/input/templates/helloworld/build.py +++ b/plugins/input/templates/helloworld/build.py @@ -22,7 +22,7 @@ Import ('env') # main SConstruct file where configuration happens # plugins can go anywhere, and be registered in custom locations by Mapnik -# but the standard location is '/usr/local/lib/mapnik2/input' +# but the standard location is '/usr/local/lib/mapnik/input' install_dest = env['MAPNIK_INPUT_PLUGINS_DEST'] # clone the environment here @@ -42,7 +42,7 @@ plugin_sources = Split( # directly link to libraries = [ '' ] # eg 'libfoo' -libraries.append('mapnik2') +libraries.append('mapnik') # link libicuuc, but ICU_LIB_NAME is used custom builds of icu can # have different library names like osx which offers /usr/lib/libicucore.dylib libraries.append(env['ICU_LIB_NAME']) diff --git a/src/build.py b/src/build.py index d6b08f72d..78f26594d 100644 --- a/src/build.py +++ b/src/build.py @@ -79,9 +79,9 @@ if not env['RUNTIME_LINK'] == 'static': if env['PLATFORM'] == 'Darwin': - mapnik_libname = 'libmapnik2.dylib' + mapnik_libname = 'libmapnik.dylib' else: - mapnik_libname = 'libmapnik2.so.' + ("%d.%d" % (ABI_VERSION[0],ABI_VERSION[1])) + mapnik_libname = 'libmapnik.so.' + ("%d.%d" % (ABI_VERSION[0],ABI_VERSION[1])) if env['PLATFORM'] == 'Darwin': if env['FULL_LIB_PATH']: @@ -307,9 +307,9 @@ else: linkflags = mapnik_lib_link_flag if env['LINKING'] == 'static': - mapnik = lib_env.StaticLibrary('mapnik2', source, LINKFLAGS=linkflags) + mapnik = lib_env.StaticLibrary('mapnik', source, LINKFLAGS=linkflags) else: - mapnik = lib_env.SharedLibrary('mapnik2', source, LINKFLAGS=linkflags) + mapnik = lib_env.SharedLibrary('mapnik', source, LINKFLAGS=linkflags) # cache library values for other builds to use env['LIBMAPNIK_LIBS'] = copy(lib_env['LIBS']) diff --git a/tests/cpp_tests/build.py b/tests/cpp_tests/build.py index e460d6e3a..11cd33f45 100644 --- a/tests/cpp_tests/build.py +++ b/tests/cpp_tests/build.py @@ -9,7 +9,7 @@ test_env = env.Clone() headers = env['CPPPATH'] libraries = copy(env['LIBMAPNIK_LIBS']) -libraries.append('mapnik2') +libraries.append('mapnik') for cpp_test in glob.glob('*_test.cpp'): test_program = test_env.Program(cpp_test.replace('.cpp',''), [cpp_test], CPPPATH=headers, LIBS=libraries, LINKFLAGS=env['CUSTOM_LDFLAGS']) diff --git a/tests/cpp_tests/svg_renderer_tests/build.py b/tests/cpp_tests/svg_renderer_tests/build.py index 8a1f52f4f..48ada0010 100644 --- a/tests/cpp_tests/svg_renderer_tests/build.py +++ b/tests/cpp_tests/svg_renderer_tests/build.py @@ -9,7 +9,7 @@ filesystem = 'boost_filesystem%s' % env['BOOST_APPEND'] system = 'boost_system%s' % env['BOOST_APPEND'] regex = 'boost_regex%s' % env['BOOST_APPEND'] -libraries = [filesystem, 'mapnik2'] +libraries = [filesystem, 'mapnik'] if env['PLATFORM'] == 'Darwin': libraries.append(env['ICU_LIB_NAME']) diff --git a/tests/python_tests/cairo_test.py b/tests/python_tests/cairo_test.py index 95a1755be..20f9f9d8b 100644 --- a/tests/python_tests/cairo_test.py +++ b/tests/python_tests/cairo_test.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import os -import mapnik2 +import mapnik from nose.tools import * from utilities import execution_path,Todo @@ -11,13 +11,13 @@ def setup(): os.chdir(execution_path('.')) def _pycairo_surface(type,sym): - if mapnik2.has_pycairo(): + if mapnik.has_pycairo(): import cairo test_cairo_file = 'test.%s' % type - m = mapnik2.Map(256,256) - mapnik2.load_map(m,'../data/good_maps/%s_symbolizer.xml' % sym) + m = mapnik.Map(256,256) + mapnik.load_map(m,'../data/good_maps/%s_symbolizer.xml' % sym) surface = getattr(cairo,'%sSurface' % type.upper())(test_cairo_file, m.width,m.height) - mapnik2.render(m, surface) + mapnik.render(m, surface) surface.finish() if os.path.exists(test_cairo_file): diff --git a/tests/python_tests/datasource_test.py b/tests/python_tests/datasource_test.py index 4d84b3346..dda6ed3e1 100644 --- a/tests/python_tests/datasource_test.py +++ b/tests/python_tests/datasource_test.py @@ -3,7 +3,7 @@ from nose.tools import * from utilities import execution_path -import os, mapnik2 +import os, mapnik def setup(): # All of the paths used are relative, if we run the tests @@ -11,36 +11,36 @@ def setup(): os.chdir(execution_path('.')) def test_field_listing(): - lyr = mapnik2.Layer('test') - lyr.datasource = mapnik2.Shapefile(file='../data/shp/poly.shp') + lyr = mapnik.Layer('test') + lyr.datasource = mapnik.Shapefile(file='../data/shp/poly.shp') fields = lyr.datasource.fields() eq_(fields, ['AREA', 'EAS_ID', 'PRFEDEA']) def test_total_feature_count_shp(): - lyr = mapnik2.Layer('test') - lyr.datasource = mapnik2.Shapefile(file='../data/shp/poly.shp') + lyr = mapnik.Layer('test') + lyr.datasource = mapnik.Shapefile(file='../data/shp/poly.shp') features = lyr.datasource.all_features() num_feats = len(features) eq_(num_feats, 10) def test_total_feature_count_json(): - lyr = mapnik2.Layer('test') - lyr.datasource = mapnik2.Ogr(file='../data/json/points.json',layer_by_index=0) + lyr = mapnik.Layer('test') + lyr.datasource = mapnik.Ogr(file='../data/json/points.json',layer_by_index=0) features = lyr.datasource.all_features() num_feats = len(features) eq_(num_feats, 5) def test_reading_json_from_string(): json = open('../data/json/points.json','r').read() - lyr = mapnik2.Layer('test') - lyr.datasource = mapnik2.Ogr(file=json,layer_by_index=0) + lyr = mapnik.Layer('test') + lyr.datasource = mapnik.Ogr(file=json,layer_by_index=0) features = lyr.datasource.all_features() num_feats = len(features) eq_(num_feats, 5) def test_feature_envelope(): - lyr = mapnik2.Layer('test') - lyr.datasource = mapnik2.Shapefile(file='../data/shp/poly.shp') + lyr = mapnik.Layer('test') + lyr.datasource = mapnik.Shapefile(file='../data/shp/poly.shp') features = lyr.datasource.all_features() for feat in features: env = feat.envelope() @@ -50,8 +50,8 @@ def test_feature_envelope(): eq_(intersects, True) def test_feature_attributes(): - lyr = mapnik2.Layer('test') - lyr.datasource = mapnik2.Shapefile(file='../data/shp/poly.shp') + lyr = mapnik.Layer('test') + lyr.datasource = mapnik.Shapefile(file='../data/shp/poly.shp') features = lyr.datasource.all_features() feat = features[0] attrs = {'PRFEDEA': u'35043411', 'EAS_ID': 168, 'AREA': 215229.266} @@ -67,8 +67,8 @@ def test_hit_grid(): """ encode a list of strings with run-length compression """ return ["%d:%s" % (len(list(group)), name) for name, group in groupby(l)] - m = mapnik2.Map(256,256); - mapnik2.load_map(m,'../data/good_maps/agg_poly_gamma_map.xml'); + m = mapnik.Map(256,256); + mapnik.load_map(m,'../data/good_maps/agg_poly_gamma_map.xml'); m.zoom_all() join_field = 'NAME' fg = [] # feature grid diff --git a/tests/python_tests/feature_id_test.py b/tests/python_tests/feature_id_test.py index 2db7e9bcc..78f5dcf72 100644 --- a/tests/python_tests/feature_id_test.py +++ b/tests/python_tests/feature_id_test.py @@ -4,7 +4,7 @@ from nose.tools import * from utilities import execution_path, Todo -import os, sys, glob, mapnik2 +import os, sys, glob, mapnik def setup(): # All of the paths used are relative, if we run the tests @@ -12,8 +12,8 @@ def setup(): os.chdir(execution_path('.')) def compare_shape_between_mapnik_and_ogr(shapefile,query=None): - ds1 = mapnik2.Ogr(file=shapefile,layer_by_index=0) - ds2 = mapnik2.Shapefile(file=shapefile) + ds1 = mapnik.Ogr(file=shapefile,layer_by_index=0) + ds2 = mapnik.Shapefile(file=shapefile) if query: fs1 = ds1.features(query) fs2 = ds2.features(query) @@ -44,8 +44,8 @@ def test_shapefile_polygon_featureset_id(): def test_shapefile_polygon_feature_query_id(): bbox = (15523428.2632, 4110477.6323, -11218494.8310, 7495720.7404) - query = mapnik2.Query(mapnik2.Box2d(*bbox)) - ds = mapnik2.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0) + query = mapnik.Query(mapnik.Box2d(*bbox)) + ds = mapnik.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0) for fld in ds.fields(): query.add_property_name(fld) compare_shape_between_mapnik_and_ogr('../data/shp/world_merc.shp',query) @@ -55,11 +55,11 @@ def test_feature_hit_count(): # results in different results between shp and ogr! #bbox = (-14284551.8434, 2074195.1992, -7474929.8687, 8140237.7628) bbox = (1113194.91,4512803.085,2226389.82,6739192.905) - query = mapnik2.Query(mapnik2.Box2d(*bbox)) - ds1 = mapnik2.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0) + query = mapnik.Query(mapnik.Box2d(*bbox)) + ds1 = mapnik.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0) for fld in ds1.fields(): query.add_property_name(fld) - ds2 = mapnik2.Shapefile(file='../data/shp/world_merc.shp') + ds2 = mapnik.Shapefile(file='../data/shp/world_merc.shp') count1 = len(ds1.features(query).features) count2 = len(ds2.features(query).features) eq_(count1,count2,"Feature count differs between OGR driver (%s features) and Shapefile Driver (%s features) when querying the same bbox" % (count1,count2)) diff --git a/tests/python_tests/feature_test.py b/tests/python_tests/feature_test.py index b933a4383..2a92ab413 100644 --- a/tests/python_tests/feature_test.py +++ b/tests/python_tests/feature_test.py @@ -6,7 +6,7 @@ from utilities import Todo class FeatureTest(unittest.TestCase): def makeOne(self, *args, **kw): - from mapnik2 import Feature + from mapnik import Feature return Feature(*args, **kw) def test_default_constructor(self): @@ -14,7 +14,7 @@ class FeatureTest(unittest.TestCase): self.failUnless(f is not None) def test_python_extended_constructor(self): - from mapnik2 import Box2d + from mapnik import Box2d f = self.makeOne(1, 'POLYGON ((35 10, 10 20, 15 40, 45 45, 35 10),(20 30, 35 35, 30 20, 20 30))', foo="bar") self.failUnlessEqual(f['foo'], 'bar') self.failUnlessEqual(f.envelope(),Box2d(10.0,10.0,45.0,45.0)) @@ -37,7 +37,7 @@ class FeatureTest(unittest.TestCase): test_val(v) def test_add_wkt_geometry(self): - from mapnik2 import Box2d + from mapnik import Box2d def add_geom_wkt(wkt): f = self.makeOne(1) self.failUnlessEqual(len(f.geometries()), 0) diff --git a/tests/python_tests/filter_test.py b/tests/python_tests/filter_test.py index 21e4865e2..bfa7e683e 100644 --- a/tests/python_tests/filter_test.py +++ b/tests/python_tests/filter_test.py @@ -4,10 +4,10 @@ from nose.tools import * from utilities import Todo -import mapnik2 +import mapnik -if hasattr(mapnik2,'Expression'): - mapnik2.Filter = mapnik2.Expression +if hasattr(mapnik,'Expression'): + mapnik.Filter = mapnik.Expression map_ = '''