[Gdal-dev] PGeo and ODBC support in OGR

Frank Warmerdam warmerdam at pobox.com
Thu Dec 1 16:56:26 EST 2005


On 12/1/05, Eugene Polishchuk <ugeni79 at gmail.com> wrote:
> Hi all,
>
>  I am currently trying to use OGR for reading and writing spatial data in
> different formats.  I have a couple of questions about OGR support for the
> following formats:
>
>  ODBC:
>  I've noticed that a new way to create an ODBC datasource:
> tablename(geometrycolname) has been added recently which is great since it
> resolves some of the performance issues that we have been experiencing, but
> when creating a datasource in this way and then subsequently calling
> ExecuteSQL on it, the layer that ExecuteSQL() returns does not appear to
> retain the geometrycolname and therefore its features do not have any
> geometry info.  Since I am new to OGR I wasn't sure whether this behavior is
> by design or is it still in development or a bug?

Eugene,

This is the expected behavior, though not really the desired
behavior.  The problem is that OGR doesn't "understand" the SQL
passed through it to ODBC and it has to examine the resultset
produced blindly which means it is very hard to work out what
is a geometry column (or what should be used as the FID).

>  PGeo:
>  With OCI and Shapefile datasources the FID's of the layer returned from
> ExecuteSQL() are from 0 to GetFeatureCount()-1, but with PGeo they appear to
> correspond to the OBJECTID of the feature.  Is this the intended behavior?

The OCI driver now includes a backdoor mechanism to pick a column
to use as the FID (via the OCI_FID config variable).  Otherwise fids
are assigned sequentially which means the fids aren't really persistant.
If the query changes (new spatial extents for instance) then the fids change.

Shapefile uses the index in the file as the fid which is persistant.

Overall, it is better for RDBMS based drivers to be able to select
a column to use as FID but when that can't be done, dummy fids
are auto-assigned.  In general you should not depend on any
particular order or continuity in fids for apps that should work on
different drivers.

>  Also do you have any plans on adding spatial reference support to OCI and
> ODBC?

I thought spatial reference support was already there (mostly) for OCI.
I have no plans to add it for ODBC.

>  And if we decide to make any changes to OGR what would be the appropriate
> process to roll our changes into the main source?

For modest changes submit the changes as patches through bugzilla
with an explanation.  If you plan to do alot of work, we can discuss
providing CVS commit access.

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