add test that asserts feature count is the same between shapefile driver and ogr (currently fails)

This commit is contained in:
Dane Springmeyer 2011-06-16 18:06:24 +00:00
parent 5f53246337
commit b31d3c89c9

View file

@ -43,8 +43,6 @@ def test_shapefile_polygon_featureset_id():
compare_shape_between_mapnik_and_ogr('../data/shp/poly.shp') compare_shape_between_mapnik_and_ogr('../data/shp/poly.shp')
def test_shapefile_polygon_feature_query_id(): def test_shapefile_polygon_feature_query_id():
# results in different results between shp and ogr!
#bbox = (-14284551.8434, 2074195.1992, -7474929.8687, 8140237.7628)
bbox = (15523428.2632, 4110477.6323, -11218494.8310, 7495720.7404) bbox = (15523428.2632, 4110477.6323, -11218494.8310, 7495720.7404)
query = mapnik2.Query(mapnik2.Box2d(*bbox)) query = mapnik2.Query(mapnik2.Box2d(*bbox))
ds = mapnik2.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0) ds = mapnik2.Ogr(file='../data/shp/world_merc.shp',layer_by_index=0)
@ -52,10 +50,22 @@ def test_shapefile_polygon_feature_query_id():
query.add_property_name(fld) query.add_property_name(fld)
compare_shape_between_mapnik_and_ogr('../data/shp/world_merc.shp',query) compare_shape_between_mapnik_and_ogr('../data/shp/world_merc.shp',query)
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)
for fld in ds1.fields():
query.add_property_name(fld)
ds2 = mapnik2.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))
if __name__ == "__main__": if __name__ == "__main__":
setup() setup()
test_shapefile_line_featureset_id() test_shapefile_line_featureset_id()
test_shapefile_polygon_featureset_id() test_shapefile_polygon_featureset_id()
test_shapefile_polygon_feature_query_id() test_shapefile_polygon_feature_query_id()
test_feature_hit_count()