Only the last polygon of a "folder" is written in a shapefile.
Mantis Issue 50, reported by gborrut, assigned to echristophe, created: 2008-12-09
If we directly write several polygons in a "folder", only the last polygon is written in a shapefile.
1229100177 - GuillaumeIndeed, in the shp format, one feature only can contain one "Shape Type" object.
( and "Shape Type" are :
ESRI Shapefile Technical Description : 0 Null Shape 1 Point 3 PolyLine 5 Polygon 8 MultiPoint 11 PointZ 13 PolyLineZ 15 PolygonZ 18 MultiPointZ 21 PointM 23 PolyLineM 25 PolygonM 28 MultiPointM 31 MultiPatch )
The solution to add several polygons is to create one folder by polygon.
For example :
(...) DataNodeType::Pointer newfolder = DataNodeType::New(); DataNodeType::Pointer document = DataNodeType::New(); DataNodeType::Pointer polygon = DataNodeType::New();
/* Description of document, newfolder, polygon */ (...)
DataNodeType::Pointer root = data->GetDataTree()->GetRoot()->Get();
data->GetDataTree()->Add(document,root); int i,nb_iter = 10000;
for ( i=0; i< nb_iter; i++){
data->GetDataTree()->Add(newfolder,document); data->GetDataTree()->Add(polygon,newfolder);
}
ogrinfo shows that the file do contain all the