[gdal-dev] Append a shapefile to a postgis table using the GDAL/OGR Python interface

2011-07-06 Thread Luke Peterson
On Sat, Jul 24, 2010 at 10:31PM, Chaitanya kumar CH wrote: > >Esben, > >I am not sure why the value is not quoted in the error report. The >PostgreSQL driver quotes the string values. >When using CreateFeature() you need to make sure to set the feature's FID to >OGRNullFID using SetFID(OGRNullFID)

Re: [gdal-dev] Append a shapefile to a postgis table using the GDAL/OGR Python interface

2011-07-06 Thread Even Rouault
Le mercredi 06 juillet 2011 17:11:31, Luke Peterson a écrit : > I'm reviving a nearly-year-old thread here, sort of. I'm trying to > create cross-compatibility between MSSQL and PostGIS on some OGR-based > code I wrote in Python for the MSSQL environment: I had been running > into issues simply cr

Re: [gdal-dev] Append a shapefile to a postgis table using the GDAL/OGR Python interface

2011-07-06 Thread Even Rouault
Le mercredi 06 juillet 2011 17:11:31, Luke Peterson a écrit : > On Sat, Jul 24, 2010 at 10:31PM, Chaitanya kumar CH Hum, wait, how come can you use CopyLayer() to append to an existing table ? CopyLayer() is supposed to create a new layer, so I don't see how it would work with an existing targe

Re: [gdal-dev] Append a shapefile to a postgis table using the GDAL/OGR Python interface

2011-07-06 Thread Luke Peterson
On Wed, Jul 6, 2011 at 2:47 PM, Even Rouault wrote: > Le mercredi 06 juillet 2011 17:11:31, Luke Peterson a écrit : >> On Sat, Jul 24, 2010 at 10:31PM, Chaitanya kumar CH > > Hum, wait, how come can you use CopyLayer() to append to an existing table ? > CopyLayer() is supposed to create a new laye

Re: [gdal-dev] Append a shapefile to a postgis table using the GDAL/OGR Python interface

2011-07-06 Thread Even Rouault
Le mercredi 06 juillet 2011 21:46:58, Luke Peterson a écrit : > You're right, an error should be expected from your append case -- but > I'm not using it to append, I'm running into this FID error on a > simple invocation of CopyLayer() in an empty schema, trying to copy a > layer from a Shapefile

Re: [gdal-dev] Append a shapefile to a postgis table using the GDAL/OGR Python interface

2011-07-06 Thread Luke Peterson
On Wed, Jul 6, 2011 at 3:56 PM, Even Rouault wrote: > Le mercredi 06 juillet 2011 21:46:58, Luke Peterson a écrit : >> What CopyLayer() is supposed to do (and the code I've written does) is >> create a new layer based on an existing layer, copies a field set from >> the source layer, then iterate

Re: [gdal-dev] Append a shapefile to a postgis table using the GDAL/OGR Python interface

2011-07-06 Thread Even Rouault
Le mercredi 06 juillet 2011 23:36:52, Luke Peterson a écrit : > On Wed, Jul 6, 2011 at 3:56 PM, Even Rouault ok, with the help of the traces, this makes sense now. The real issue is that the warning and error : > Warning 1: Geometry to be inserted is of type Multi Polygon, whereas > the layer ge

Re: [gdal-dev] Append a shapefile to a postgis table using the GDAL/OGR Python interface

2011-07-06 Thread Chaitanya kumar CH
Luke, Please check if there are features with duplicate FIDs in the MSSQL datasource. The 'uniqueness' of the FIDs is not checked throughly in OGR. Some may slip through. Resetting the FIDs is not always desirable. Some applications might need to retain the old FIDs. However, having an option to

Re: [gdal-dev] Append a shapefile to a postgis table using the GDAL/OGR Python interface

2011-07-06 Thread Luke Peterson
On Wed, Jul 6, 2011 at 5:51 PM, Even Rouault wrote: > It is just that CreateLayer() will declare the geometry as being Polygon, > but > insert MultiPolygon sometimes. That's one of the caveats with the shapefile > format/driver that will report a layer as being of type wkbPolygon but can > return