On 7 October 2015 at 13:18, Even Rouault <[email protected]> wrote:
> > Luca, > Hi Even, > I'm not completely sure if this is the reason, but there's at least something > to correct related to the use of: > > self.feat_defn.AddFieldDefn(style_field) > > Quoting OGRFeatureDefn::AddFieldDefn() documentation > http://gdal.org/classOGRFeatureDefn.html#a40e681d8464b42f1a1fac655f16ac3dd : > > "To add a new field definition to a layer definition, do not use this function > directly, but use OGRLayer::CreateField() instead." > > Hum actually looking more closely, I think the issue is that you modify the > layer definition after having accumulated features in the "features" > dictionary. > > Still quoting OGRFeatureDefn::AddFieldDefn() documentation > "This method should only be called while there are no OGRFeature objects in > existance based on this OGRFeatureDefn." > > So you should probably call outLayer.CreateField() before reading the postgres > features. > CreateField works perfectly, I also removed the workaround for postgresql Thanks a lot > Even > -- ciao Luca http://gis.cri.fmach.it/delucchi/ www.lucadelu.org _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
