Merge branch 'master' into feature_impl

This commit is contained in:
Artem Pavlenko 2012-01-18 07:48:57 -05:00 committed by Artem Pavlenko
commit e699ba17cb
3 changed files with 11 additions and 2 deletions

View file

@ -28,6 +28,8 @@
#include <mapnik/ptree_helpers.hpp> #include <mapnik/ptree_helpers.hpp>
#include <mapnik/geom_util.hpp> #include <mapnik/geom_util.hpp>
#include <gdal_version.h>
using mapnik::datasource; using mapnik::datasource;
using mapnik::parameters; using mapnik::parameters;

View file

@ -30,6 +30,8 @@
#include "ogr_index_featureset.hpp" #include "ogr_index_featureset.hpp"
#include "ogr_feature_ptr.hpp" #include "ogr_feature_ptr.hpp"
#include <gdal_version.h>
// mapnik // mapnik
#include <mapnik/ptree_helpers.hpp> #include <mapnik/ptree_helpers.hpp>
#include <mapnik/geom_util.hpp> #include <mapnik/geom_util.hpp>
@ -350,7 +352,11 @@ boost::optional<mapnik::datasource::geometry_t> ogr_datasource::get_geometry_typ
{ {
OGRLayer* layer = layer_.layer(); OGRLayer* layer = layer_.layer();
// NOTE: wkbFlatten macro in ogr flattens 2.5d types into base 2d type // NOTE: wkbFlatten macro in ogr flattens 2.5d types into base 2d type
#if GDAL_VERSION_NUM < 1800
switch (wkbFlatten(layer->GetLayerDefn()->GetGeomType()))
#else
switch (wkbFlatten(layer->GetGeomType())) switch (wkbFlatten(layer->GetGeomType()))
#endif
{ {
case wkbPoint: case wkbPoint:
case wkbMultiPoint: case wkbMultiPoint:

View file

@ -26,8 +26,9 @@ if 'ogr' in mapnik.DatasourceCache.instance().plugin_names():
# Shapefile properties # Shapefile properties
def test_shapefile_properties(): def test_shapefile_properties():
s = mapnik.Ogr(file='../../demo/data/boundaries.shp',layer_by_index=0,encoding='latin1') ds = mapnik.Ogr(file='../../demo/data/boundaries.shp',layer_by_index=0,encoding='latin1')
f = s.features_at_point(s.envelope().center()).features[0] f = ds.features_at_point(ds.envelope().center()).features[0]
eq_(ds.geometry_type(),mapnik.DataGeometryType.Polygon)
eq_(f['CGNS_FID'], u'6f733341ba2011d892e2080020a0f4c9') eq_(f['CGNS_FID'], u'6f733341ba2011d892e2080020a0f4c9')
eq_(f['COUNTRY'], u'CAN') eq_(f['COUNTRY'], u'CAN')