diff --git a/docs/contributing.markdown b/docs/contributing.markdown index c6938e3e5..2a0a038a3 100644 --- a/docs/contributing.markdown +++ b/docs/contributing.markdown @@ -153,6 +153,14 @@ If you see bits of code around that do not follow these please don't hesitate to // more... } +#### Prefer `empty()` over `size() == 0` if container supports it + +This avoids implicit conversions to bool and reduces compiler warnings. + + if (container.empty()) // please + + if (container.size() == 0) // no + ### Other C++ style resources diff --git a/plugins/input/csv/csv_datasource.cpp b/plugins/input/csv/csv_datasource.cpp index 9352bbf71..a08dc833a 100644 --- a/plugins/input/csv/csv_datasource.cpp +++ b/plugins/input/csv/csv_datasource.cpp @@ -665,7 +665,9 @@ void csv_datasource::parse_csv(T & stream, } } - // now, add all values as attributes + // now, add attributes, skipping any WKT or JSON fiels + if ((has_wkt_field) && (i == wkt_idx)) continue; + if ((has_json_field) && (i == json_idx)) continue; /* First we detect likely strings, then try parsing likely numbers, finally falling back to string type * We intentionally do not try to detect boolean or null types diff --git a/plugins/input/raster/raster_datasource.cpp b/plugins/input/raster/raster_datasource.cpp index 1a33952c8..f758ae736 100644 --- a/plugins/input/raster/raster_datasource.cpp +++ b/plugins/input/raster/raster_datasource.cpp @@ -62,8 +62,8 @@ raster_datasource::raster_datasource(parameters const& params, bool bind) filename_ = *file; multi_tiles_ = *params_.get("multi", false); - tile_size_ = *params_.get("tile-size", 256); - tile_stride_ = *params_.get("tile-stride", 1); + tile_size_ = *params_.get("tile_size", 256); + tile_stride_ = *params_.get("tile_stride", 1); format_ = *params_.get("format","tiff"); @@ -100,8 +100,8 @@ void raster_datasource::bind() const if (multi_tiles_) { - boost::optional x_width = params_.get("x-width"); - boost::optional y_width = params_.get("y-width"); + boost::optional x_width = params_.get("x_width"); + boost::optional y_width = params_.get("y_width"); if (! x_width) { diff --git a/src/agg/process_raster_symbolizer.cpp b/src/agg/process_raster_symbolizer.cpp index dbdcc88b7..2830b2564 100644 --- a/src/agg/process_raster_symbolizer.cpp +++ b/src/agg/process_raster_symbolizer.cpp @@ -83,7 +83,8 @@ void agg_renderer::process(raster_symbolizer const& sym, if (scaling_method == SCALING_BILINEAR8) { scale_image_bilinear8(target.data_,source->data_, 0.0, 0.0); - } else + } + else { double scaling_ratio = ext.width() / source->data_.width(); scale_image_agg(target.data_, diff --git a/src/load_map.cpp b/src/load_map.cpp index dfdbf47c9..344793ef9 100644 --- a/src/load_map.cpp +++ b/src/load_map.cpp @@ -1154,7 +1154,7 @@ void map_parser::parse_text_symbolizer(rule & rule, xml_node const& sym) placement_finder->defaults.from_xml(sym, fontsets_); } if (strict_ && - !placement_finder->defaults.format.fontset->size()) + !placement_finder->defaults.format.fontset) { ensure_font_face(placement_finder->defaults.format.face_name); } @@ -1183,7 +1183,7 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& sym) } placement_finder->defaults.from_xml(sym, fontsets_); if (strict_ && - !placement_finder->defaults.format.fontset->size()) + !placement_finder->defaults.format.fontset) { ensure_font_face(placement_finder->defaults.format.face_name); } diff --git a/src/warp.cpp b/src/warp.cpp index 60232b01e..4fa185d94 100644 --- a/src/warp.cpp +++ b/src/warp.cpp @@ -47,11 +47,11 @@ namespace mapnik { void reproject_and_scale_raster(raster & target, raster const& source, - proj_transform const& prj_trans, - double offset_x, double offset_y, - unsigned mesh_size, - double filter_radius, - scaling_method_e scaling_method) + proj_transform const& prj_trans, + double offset_x, double offset_y, + unsigned mesh_size, + double filter_radius, + scaling_method_e scaling_method) { CoordTransform ts(source.data_.width(), source.data_.height(), source.ext_); @@ -160,10 +160,10 @@ void reproject_and_scale_raster(raster & target, raster const& source, tt.forward(polygon+6, polygon+7); rasterizer.reset(); - rasterizer.move_to_d(polygon[0]-1, polygon[1]-1); - rasterizer.line_to_d(polygon[2]+1, polygon[3]-1); - rasterizer.line_to_d(polygon[4]+1, polygon[5]+1); - rasterizer.line_to_d(polygon[6]-1, polygon[7]+1); + rasterizer.move_to_d(std::floor(polygon[0]), std::floor(polygon[1])); + rasterizer.line_to_d(std::floor(polygon[2]), std::floor(polygon[3])); + rasterizer.line_to_d(std::floor(polygon[4]), std::floor(polygon[5])); + rasterizer.line_to_d(std::floor(polygon[6]), std::floor(polygon[7])); unsigned x0 = i * mesh_size; unsigned y0 = j * mesh_size; diff --git a/tests/data/csv/fails/unix_newlines_with_windows_inline.csv b/tests/data/csv/fails/unix_newlines_with_windows_inline.csv new file mode 100644 index 000000000..b3199757b --- /dev/null +++ b/tests/data/csv/fails/unix_newlines_with_windows_inline.csv @@ -0,0 +1,7 @@ +x,y,line +0,0," + many + lines + of text + with unix newlines + " diff --git a/tests/data/csv/fails/unix_newlines_with_windows_inline_escaped.csv b/tests/data/csv/fails/unix_newlines_with_windows_inline_escaped.csv new file mode 100644 index 000000000..5b981a68d --- /dev/null +++ b/tests/data/csv/fails/unix_newlines_with_windows_inline_escaped.csv @@ -0,0 +1,2 @@ +x,y,line +0,0,"\r\nmany\r\nlines\r\nof text\r\nwith unix newlines\r\n" diff --git a/tests/data/csv/mac_newlines_with_unix_inline.csv b/tests/data/csv/mac_newlines_with_unix_inline.csv new file mode 100644 index 000000000..f748c05bd --- /dev/null +++ b/tests/data/csv/mac_newlines_with_unix_inline.csv @@ -0,0 +1,7 @@ +x,y,line +0,0," + many + lines + of text + with unix newlines + " diff --git a/tests/data/csv/mac_newlines_with_unix_inline_escaped.csv b/tests/data/csv/mac_newlines_with_unix_inline_escaped.csv new file mode 100644 index 000000000..5f551d327 --- /dev/null +++ b/tests/data/csv/mac_newlines_with_unix_inline_escaped.csv @@ -0,0 +1,2 @@ +x,y,line +0,0,"many\n lines\n of text\n with unix newlines" diff --git a/tests/data/csv/windows_newlines_with_unix_inline.csv b/tests/data/csv/windows_newlines_with_unix_inline.csv new file mode 100644 index 000000000..f748c05bd --- /dev/null +++ b/tests/data/csv/windows_newlines_with_unix_inline.csv @@ -0,0 +1,7 @@ +x,y,line +0,0," + many + lines + of text + with unix newlines + " diff --git a/tests/data/csv/windows_newlines_with_unix_inline_escaped.csv b/tests/data/csv/windows_newlines_with_unix_inline_escaped.csv new file mode 100644 index 000000000..5f551d327 --- /dev/null +++ b/tests/data/csv/windows_newlines_with_unix_inline_escaped.csv @@ -0,0 +1,2 @@ +x,y,line +0,0,"many\n lines\n of text\n with unix newlines" diff --git a/tests/python_tests/csv_test.py b/tests/python_tests/csv_test.py index 211be6b39..ea57f245d 100644 --- a/tests/python_tests/csv_test.py +++ b/tests/python_tests/csv_test.py @@ -6,6 +6,8 @@ from nose.tools import * from utilities import execution_path import os, mapnik +# make the tests silent since we intentially test error conditions that are noisy +mapnik.logger.set_severity(mapnik.severity_type.None) def setup(): # All of the paths used are relative, if we run the tests @@ -137,9 +139,9 @@ if 'csv' in mapnik.DatasourceCache.plugin_names(): def test_wkt_field(**kwargs): ds = get_csv_ds('wkt.csv') - eq_(len(ds.fields()),2) - eq_(ds.fields(),['type','WKT']) - eq_(ds.field_types(),['str','str']) + eq_(len(ds.fields()),1) + eq_(ds.fields(),['type']) + eq_(ds.field_types(),['str']) fs = ds.all_features() eq_(len(fs[0].geometries()),1) eq_(fs[0].geometries()[0].type(),mapnik.DataGeometryType.Point) @@ -396,9 +398,9 @@ if 'csv' in mapnik.DatasourceCache.plugin_names(): eq_(feat['Name'],u"Winthrop, WA") def validate_geojson_datasource(ds): - eq_(len(ds.fields()),2) - eq_(ds.fields(),['type','GeoJSON']) - eq_(ds.field_types(),['str','str']) + eq_(len(ds.fields()),1) + eq_(ds.fields(),['type']) + eq_(ds.field_types(),['str']) fs = ds.all_features() eq_(len(fs[0].geometries()),1) eq_(fs[0].geometries()[0].type(),mapnik.DataGeometryType.Point) diff --git a/tests/python_tests/json_feature_properties_test.py b/tests/python_tests/json_feature_properties_test.py index 2eb92a20a..0f27810c3 100644 --- a/tests/python_tests/json_feature_properties_test.py +++ b/tests/python_tests/json_feature_properties_test.py @@ -3,7 +3,10 @@ from nose.tools import * import os,sys import mapnik -import json +try: + import json +except ImportError: + import simplejson as json chars = [ { diff --git a/tests/python_tests/multi_tile_raster_test.py b/tests/python_tests/multi_tile_raster_test.py index ce2854f31..fff685487 100644 --- a/tests/python_tests/multi_tile_raster_test.py +++ b/tests/python_tests/multi_tile_raster_test.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from nose.tools import * -from utilities import execution_path, save_data, contains_word +from utilities import execution_path, contains_word import os, mapnik @@ -40,8 +40,6 @@ def test_multi_tile_policy(): im = mapnik.Image(_map.width, _map.height) mapnik.render(_map, im) - save_data('test_multi_tile_policy.png', im.tostring('png')) - # test green chunk eq_(im.view(0,64,1,1).tostring(), '\x00\xff\x00\xff') eq_(im.view(127,64,1,1).tostring(), '\x00\xff\x00\xff') diff --git a/tests/python_tests/raster_alpha_test.py b/tests/python_tests/raster_alpha_test.py deleted file mode 100644 index 4346b0d2e..000000000 --- a/tests/python_tests/raster_alpha_test.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python - -from nose.tools import * -from utilities import execution_path - -import os, mapnik - -def setup(): - # All of the paths used are relative, if we run the tests - # from another directory we need to chdir() - os.chdir(execution_path('.')) - -if 'gdal' in mapnik.DatasourceCache.plugin_names(): - - def test_map_alpha_compare(): - m = mapnik.Map(600,400) - mapnik.load_map(m,'../data/good_maps/raster-alpha.xml') - m.zoom_all() - actual = '/tmp/mapnik-raster-alpha.png' - expected = 'images/support/raster-alpha.png' - im = mapnik.Image(m.width,m.height) - mapnik.render(m,im) - im.save(actual) - expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) - - def test_map_alpha_gradient_compare(): - m = mapnik.Map(600,400) - mapnik.load_map(m,'../data/good_maps/raster-alpha-gradient.xml') - m.zoom_all() - actual = '/tmp/mapnik-raster-alpha-gradient.png' - expected = 'images/support/raster-alpha-gradient.png' - im = mapnik.Image(m.width,m.height) - mapnik.render(m,im) - im.save(actual) - expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) - - # there should be no gray edges on raster - # https://github.com/mapnik/mapnik/issues/1471 - def test_edge_scaling_with_nodata(): - m = mapnik.Map(600,400) - mapnik.load_map(m,'../data/good_maps/raster-nodata-edge.xml') - m.zoom_all() - actual = '/tmp/mapnik-raster-nodata-edge.png' - expected = 'images/support/raster-nodata-edge.png' - im = mapnik.Image(m.width,m.height) - mapnik.render(m,im) - im.save(actual) - expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) - - -if __name__ == "__main__": - setup() - [eval(run)() for run in dir() if 'test_' in run] diff --git a/tests/python_tests/raster_symbolizer_test.py b/tests/python_tests/raster_symbolizer_test.py index f285c615f..9e7870703 100644 --- a/tests/python_tests/raster_symbolizer_test.py +++ b/tests/python_tests/raster_symbolizer_test.py @@ -1,7 +1,7 @@ #!/usr/bin/env python from nose.tools import * -from utilities import execution_path, save_data, contains_word +from utilities import execution_path, contains_word import os, mapnik @@ -51,8 +51,6 @@ def test_dataraster_coloring(): im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - # save a png somewhere so we can see it - save_data('test_dataraster_coloring.png', im.tostring('png')) imdata = im.tostring() # we have some values in the [20,30) interval so check that they're colored assert contains_word('\xff\xff\x00\xff', imdata) @@ -135,8 +133,6 @@ def test_raster_with_alpha_blends_correctly_with_background(): mim = mapnik.Image(WIDTH, HEIGHT) mapnik.render(map, mim) - save_data('test_raster_with_alpha_blends_correctly_with_background.png', - mim.tostring('png')) imdata = mim.tostring() # All white is expected assert contains_word('\xff\xff\xff\xff', imdata) @@ -166,8 +162,6 @@ def test_raster_warping(): im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - # save a png somewhere so we can see it - save_data('test_raster_warping.png', im.tostring('png')) imdata = im.tostring() assert contains_word('\xff\xff\x00\xff', imdata) @@ -195,9 +189,6 @@ def test_raster_warping_does_not_overclip_source(): im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - # save a png somewhere so we can see it - save_data('test_raster_warping_does_not_overclip_source.png', - im.tostring('png')) assert im.view(0,200,1,1).tostring()=='\xff\xff\x00\xff' if __name__ == "__main__": diff --git a/tests/python_tests/utilities.py b/tests/python_tests/utilities.py index f76c5e54a..b47df7be4 100644 --- a/tests/python_tests/utilities.py +++ b/tests/python_tests/utilities.py @@ -15,20 +15,6 @@ class TodoPlugin(ErrorClassPlugin): todo = ErrorClass(Todo, label='TODO', isfailure=False) -def save_data(filename, data, key='MAPNIK_TEST_DATA_DIR'): - """Saves bytestring 'data' into os.environ[key]/filename if - key in os.environ""" - if key in os.environ: - dir = os.environ[key] - if not os.path.exists(dir): - os.makedirs(dir) - fname = os.path.join(dir, filename) - f = open(fname, 'w') - try: - f.write(data) - finally: - f.close() - def contains_word(word, bytestring_): """ Checks that a bytestring contains a given word. len(bytestring) should be diff --git a/tests/visual_tests/.gitignore b/tests/visual_tests/.gitignore index 0f3e46ba4..a39b72071 100644 --- a/tests/visual_tests/.gitignore +++ b/tests/visual_tests/.gitignore @@ -1,2 +1 @@ -*-agg.png *-out.xml diff --git a/tests/visual_tests/clean.sh b/tests/visual_tests/clean.sh index 1278159f4..d5ae9e4de 100755 --- a/tests/visual_tests/clean.sh +++ b/tests/visual_tests/clean.sh @@ -1,3 +1,2 @@ -rm -f images/*-agg.png rm -f xml_output/*-out.xml diff --git a/tests/visual_tests/compare.py b/tests/visual_tests/compare.py index 8fa26360e..43bd251d9 100644 --- a/tests/visual_tests/compare.py +++ b/tests/visual_tests/compare.py @@ -49,7 +49,7 @@ def compare(actual, expected): passed += 1 return diff -def summary(): +def summary(generate=False): global errors global passed print "-"*80 @@ -57,7 +57,13 @@ def summary(): if len(errors) != 0: for error in errors: if (error[0] is None): - print "Could not verify %s: No reference image found!" % error[1] + if generate: + actual = open(error[1],'r').read() + open(error[2],'wb').write(actual) + print "Generating reference image: '%s'" % error[2] + continue + else: + print "Could not verify %s: No reference image found!" % error[1] else: print "Failed: %d different pixels:\n\t%s (actual)\n\t%s (expected)" % error sys.exit(1) diff --git a/tests/visual_tests/images/tiff-alpha-gdal-600-reference.png b/tests/visual_tests/images/tiff-alpha-gdal-600-reference.png new file mode 100644 index 000000000..3c79bb304 Binary files /dev/null and b/tests/visual_tests/images/tiff-alpha-gdal-600-reference.png differ diff --git a/tests/python_tests/images/support/raster-alpha-gradient.png b/tests/visual_tests/images/tiff-alpha-gradient-gdal-600-reference.png similarity index 100% rename from tests/python_tests/images/support/raster-alpha-gradient.png rename to tests/visual_tests/images/tiff-alpha-gradient-gdal-600-reference.png diff --git a/tests/visual_tests/images/tiff-alpha-gradient-raster-600-reference.png b/tests/visual_tests/images/tiff-alpha-gradient-raster-600-reference.png new file mode 100644 index 000000000..92c3aaf2d Binary files /dev/null and b/tests/visual_tests/images/tiff-alpha-gradient-raster-600-reference.png differ diff --git a/tests/visual_tests/images/tiff-alpha-raster-600-reference.png b/tests/visual_tests/images/tiff-alpha-raster-600-reference.png new file mode 100644 index 000000000..3c79bb304 Binary files /dev/null and b/tests/visual_tests/images/tiff-alpha-raster-600-reference.png differ diff --git a/tests/python_tests/images/support/raster-nodata-edge.png b/tests/visual_tests/images/tiff-nodata-edge-gdal-600-reference.png similarity index 100% rename from tests/python_tests/images/support/raster-nodata-edge.png rename to tests/visual_tests/images/tiff-nodata-edge-gdal-600-reference.png diff --git a/tests/visual_tests/images/tiff-nodata-edge-raster-600-reference.png b/tests/visual_tests/images/tiff-nodata-edge-raster-600-reference.png new file mode 100644 index 000000000..df5fa419e Binary files /dev/null and b/tests/visual_tests/images/tiff-nodata-edge-raster-600-reference.png differ diff --git a/tests/data/good_maps/raster-alpha.xml b/tests/visual_tests/styles/tiff-alpha-gdal.xml similarity index 89% rename from tests/data/good_maps/raster-alpha.xml rename to tests/visual_tests/styles/tiff-alpha-gdal.xml index ab643c7aa..e7fe88453 100644 --- a/tests/data/good_maps/raster-alpha.xml +++ b/tests/visual_tests/styles/tiff-alpha-gdal.xml @@ -11,7 +11,7 @@ srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"> white - ../raster/white-alpha.tiff + ../../data/raster/white-alpha.tiff gdal diff --git a/tests/data/good_maps/raster-alpha-gradient.xml b/tests/visual_tests/styles/tiff-alpha-gradient-gdal.xml similarity index 89% rename from tests/data/good_maps/raster-alpha-gradient.xml rename to tests/visual_tests/styles/tiff-alpha-gradient-gdal.xml index b906668f2..7730bba4d 100644 --- a/tests/data/good_maps/raster-alpha-gradient.xml +++ b/tests/visual_tests/styles/tiff-alpha-gradient-gdal.xml @@ -11,7 +11,7 @@ srs="+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over"> transp - ../raster/transp.tiff + ../../data/raster/transp.tiff gdal diff --git a/tests/visual_tests/styles/tiff-alpha-gradient-raster.xml b/tests/visual_tests/styles/tiff-alpha-gradient-raster.xml new file mode 100644 index 000000000..485a5fc1f --- /dev/null +++ b/tests/visual_tests/styles/tiff-alpha-gradient-raster.xml @@ -0,0 +1,20 @@ + + + + + + + transp + + ../../data/raster/transp.tiff + raster + 0,0,256,256 + + + + \ No newline at end of file diff --git a/tests/visual_tests/styles/tiff-alpha-raster.xml b/tests/visual_tests/styles/tiff-alpha-raster.xml new file mode 100644 index 000000000..ce9e2fb6c --- /dev/null +++ b/tests/visual_tests/styles/tiff-alpha-raster.xml @@ -0,0 +1,20 @@ + + + + + + + white + + ../../data/raster/white-alpha.tiff + raster + 1001859.9561,5922814.94334,1021141.75555,5942096.74279 + + + + \ No newline at end of file diff --git a/tests/data/good_maps/raster-nodata-edge.xml b/tests/visual_tests/styles/tiff-nodata-edge-gdal.xml similarity index 89% rename from tests/data/good_maps/raster-nodata-edge.xml rename to tests/visual_tests/styles/tiff-nodata-edge-gdal.xml index ce2a93425..21ed737b1 100644 --- a/tests/data/good_maps/raster-nodata-edge.xml +++ b/tests/visual_tests/styles/tiff-nodata-edge-gdal.xml @@ -12,7 +12,7 @@ style - ../raster/nodata-edge.tif + ../../data/raster/nodata-edge.tif gdal diff --git a/tests/visual_tests/styles/tiff-nodata-edge-raster.xml b/tests/visual_tests/styles/tiff-nodata-edge-raster.xml new file mode 100644 index 000000000..0700c746b --- /dev/null +++ b/tests/visual_tests/styles/tiff-nodata-edge-raster.xml @@ -0,0 +1,21 @@ + + + + + + + style + + + ../../data/raster/nodata-edge.tif + raster + -12329035.765216826,4508650.398543958,-12328653.027947057,4508957.346255356 + + + + \ No newline at end of file diff --git a/tests/visual_tests/test.py b/tests/visual_tests/test.py index ddcec05bf..1fe3167cf 100755 --- a/tests/visual_tests/test.py +++ b/tests/visual_tests/test.py @@ -7,8 +7,7 @@ import os.path from compare import compare, summary defaults = { - 'sizes': [(500, 100)], - 'bbox': mapnik.Box2d(-0.05, -0.01, 0.95, 0.01) + 'sizes': [(500, 100)] } sizes_many_in_big_range = [(800, 100), (600, 100), (400, 100), @@ -18,33 +17,39 @@ sizes_few_square = [(800, 800), (600, 600), (400, 400), (200, 200)] sizes_many_in_small_range = [(490, 100), (495, 100), (497, 100), (498, 100), (499, 100), (500, 100), (501, 100), (502, 100), (505, 100), (510, 100)] +default_text_box = mapnik.Box2d(-0.05, -0.01, 0.95, 0.01) + dirname = os.path.dirname(__file__) files = [ - {'name': "list", 'sizes': sizes_many_in_big_range}, - {'name': "simple", 'sizes': sizes_many_in_big_range}, - {'name': "lines-1", 'sizes': sizes_few_square}, - {'name': "lines-2", 'sizes': sizes_few_square}, - {'name': "lines-3", 'sizes': sizes_few_square}, - {'name': "lines-shield", 'sizes': sizes_few_square}, - {'name': "simple-E"}, - {'name': "simple-NE"}, - {'name': "simple-NW"}, - {'name': "simple-N"}, - {'name': "simple-SE"}, - {'name': "simple-SW"}, - {'name': "simple-S"}, - {'name': "simple-W"}, - {'name': "formatting-1"}, - {'name': "formatting-2"}, - {'name': "formatting-3"}, - {'name': "formatting-4"}, - {'name': "expressionformat"}, - {'name': "shieldsymbolizer-1", 'sizes': sizes_many_in_small_range}, - {'name': "rtl-point", 'sizes': [(200, 200)]}, - {'name': "jalign-auto", 'sizes': [(200, 200)]}, - {'name': "line-offset", 'sizes':[(900, 250)], - 'bbox': mapnik.Box2d(-5.192, 50.189, -5.174, 50.195)}, + {'name': "list", 'sizes': sizes_many_in_big_range,'bbox':default_text_box}, + {'name': "simple", 'sizes': sizes_many_in_big_range,'bbox':default_text_box}, + {'name': "lines-1", 'sizes': sizes_few_square,'bbox':default_text_box}, + {'name': "lines-2", 'sizes': sizes_few_square,'bbox':default_text_box}, + {'name': "lines-3", 'sizes': sizes_few_square,'bbox':default_text_box}, + {'name': "lines-shield", 'sizes': sizes_few_square,'bbox':default_text_box}, + {'name': "simple-E", 'bbox':mapnik.Box2d(-0.05, -0.01, 0.95, 0.01)}, + {'name': "simple-NE",'bbox':default_text_box}, + {'name': "simple-NW",'bbox':default_text_box}, + {'name': "simple-N",'bbox':default_text_box}, + {'name': "simple-SE",'bbox':default_text_box}, + {'name': "simple-SW",'bbox':default_text_box}, + {'name': "simple-S",'bbox':default_text_box}, + {'name': "simple-W",'bbox':default_text_box}, + {'name': "formatting-1",'bbox':default_text_box}, + {'name': "formatting-2",'bbox':default_text_box}, + {'name': "formatting-3",'bbox':default_text_box}, + {'name': "formatting-4",'bbox':default_text_box}, + {'name': "expressionformat",'bbox':default_text_box}, + {'name': "shieldsymbolizer-1", 'sizes': sizes_many_in_small_range,'bbox':default_text_box}, + {'name': "rtl-point", 'sizes': [(200, 200)],'bbox':default_text_box}, + {'name': "jalign-auto", 'sizes': [(200, 200)],'bbox':default_text_box}, + {'name': "line-offset", 'sizes':[(900, 250)],'bbox': mapnik.Box2d(-5.192, 50.189, -5.174, 50.195)}, + {'name': "tiff-alpha-gdal", 'sizes':[(600,400)]}, + {'name': "tiff-alpha-raster", 'sizes':[(600,400)]}, + {'name': "tiff-alpha-gradient-gdal", 'sizes':[(600,400)]}, + {'name': "tiff-nodata-edge-gdal", 'sizes':[(600,400)]}, + {'name': "tiff-nodata-edge-raster", 'sizes':[(600,400)]}, ] def render(filename, width, height, bbox, quiet=False): @@ -89,7 +94,7 @@ if __name__ == "__main__": config = dict(defaults) config.update(f) for size in config['sizes']: - m = render(config['name'], size[0], size[1], config['bbox'], quiet=quiet) + m = render(config['name'], size[0], size[1], config.get('bbox'), quiet=quiet) mapnik.save_map(m, os.path.join(dirname, 'xml_output', "%s-out.xml" % config['name'])) - summary() + summary(generate=False)