[Gdal-dev] 2 layers in postgis; getnextfeature(); C++

Frank Warmerdam warmerdam at pobox.com
Wed Oct 19 10:13:01 EDT 2005


On 10/19/05, Thomas Windholz <thomw00 at yahoo.com> wrote:
>
> Hello List,
>
> I would like to handle two ogrlayers from a postgres database. When using
> getnextfeature or executesql in nested loops it fails. I am not sure if it
> is that either ogr is supposed to work this way or if it's just me ...
>
> any help is appreciated!

Thomas,

Unfortunately, it is not currently possible to have multiple queries
active on a single PostGIS OGRDataSource at one time the
way things are setup.  When you do ResetReading() and read
a feature on a layer, internally a transaction is active to handle that.
Trying to read on another layer messes that up.

I'm not sure what error you encountered.  It may be that I could
at least do a better job of recognising an active transaction and
terminating it.

You could open two distinct instances of OGRDataSource
and access one table via each of them.  This should work
fine though it does add some extra overhead.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list