From e32c2253078ef5cced588c90004e1d1912b18f80 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 7 Aug 2013 18:58:01 -0400 Subject: [PATCH] fix handling of F and O type dbf fields and sync handling for attribute_descriptors - refs #1614 and closes #1976 --- CHANGELOG.md | 2 ++ plugins/input/shape/dbfile.cpp | 6 ++++-- plugins/input/shape/shape_datasource.cpp | 12 +++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30e0d1210..9697b47af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ For a complete change history, see the git log. ## Future +- Fixed regression in handling `F` type dbf fields, introduced in v2.2.0. + - Added the ability to create a mapnik Feature from a geojson feature with `mapnik.Feature.from_geojson` in python. - Added to python bindings: `has_tiff`, `has_png`, `has_webp`, `has_proj4`, `has_svg_renderer`, and `has_grid_renderer` diff --git a/plugins/input/shape/dbfile.cpp b/plugins/input/shape/dbfile.cpp index 230320c76..e3b8a0994 100644 --- a/plugins/input/shape/dbfile.cpp +++ b/plugins/input/shape/dbfile.cpp @@ -141,6 +141,7 @@ void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, mapnik::feat { std::string const& name=fields_[col].name_; + // NOTE: ensure types handled here are matched in shape_datasource.cpp switch (fields_[col].type_) { case 'C': @@ -166,8 +167,9 @@ void dbf_file::add_attribute(int col, mapnik::transcoder const& tr, mapnik::feat } break; } - case 'N': - case 'F': + case 'N': // numeric + case 'O': // double + case 'F': // float { if (record_[fields_[col].offset_] == '*') diff --git a/plugins/input/shape/shape_datasource.cpp b/plugins/input/shape/shape_datasource.cpp index 1ba9564d7..f147bb5a9 100644 --- a/plugins/input/shape/shape_datasource.cpp +++ b/plugins/input/shape/shape_datasource.cpp @@ -105,15 +105,13 @@ shape_datasource::shape_datasource(const parameters ¶ms) switch (fd.type_) { case 'C': // character - case 'D': // Date - case 'M': // Memo, a string - case '@': // timestamp + case 'D': // date desc_.add_descriptor(attribute_descriptor(fld_name, String)); break; case 'L': // logical desc_.add_descriptor(attribute_descriptor(fld_name, Boolean)); break; - case 'N': + case 'N': // numeric case 'O': // double case 'F': // float { @@ -131,7 +129,11 @@ shape_datasource::shape_datasource(const parameters ¶ms) // I - long // G - ole // + - autoincrement - MAPNIK_LOG_WARN(shape) << "shape_datasource: Unknown type=" << fd.type_; + // @ - timestamp + // B - binary + // l - long + // M - memo + MAPNIK_LOG_ERROR(shape) << "shape_datasource: Unknown type=" << fd.type_; break; } }