Re: [gdal-dev] Updating a single PostgreSQL field from ogr/python

2012-05-16 Thread Luca Sigfrido Percich
Hi Martin, Il giorno mar, 15/05/2012 alle 11.50 +0200, Martin Jensen ha scritto: > I ended up using the ExecuteSQL method because the SetFeature > method deleted the content of the other fields. I'm sure there is an > obvious solution to this also but I didn' t find it :) SetFeature replaces

Re: [gdal-dev] Updating a single PostgreSQL field from ogr/python

2012-05-15 Thread Martin Jensen
Luca, thank you so much for your help. For a programming beginner like me, the obvious is not alway so clear! Now I see the light :) I ended up using the ExecuteSQL method because the SetFeature method deleted the content of the other fields. I'm sure there is an obvious solution to this als

Re: [gdal-dev] Updating a single PostgreSQL field from ogr/python

2012-05-14 Thread Luca Sigfrido Percich
Martin, you're updating existing features so you don't want to use the CreateFeature method. If you try to re-insert an existing feature you will get the duplicate pk error. See the docs for the SetFeature method. Moreover, your loop code is a bit confused; usually you would do: while True:

[gdal-dev] Updating a single PostgreSQL field from ogr/python

2012-05-12 Thread Martin Jensen
Hi list, I was trying to do the following with ogr python bindings 1. Create srclayer from PostGIS based on sql statement 2. Copy srclayer to dstlayer (also PostGIS) 3. Add new field to dstlayer 4. assign value to new field My code is this: ### Open Database Driver = ogr.GetDriver