[gdal-dev] OGR OVF has no identified FID column

David Lowther dlowther at COORDINATESOLUTIONS.COM
Thu Aug 19 14:56:38 EDT 2010


List,
	
I have an OVF layer defined as follows:

<OGRVRTDataSource>
        <OGRVRTLayer name="UserPoint">
         <SrcDataSource>ODBC:un/pw at CLO</SrcDataSource>
         <SrcSQL>select PKey as FID, Feature from PointData</SrcSQL>
         <GeometryField encoding="WKB" field="Feature"/>
  <FID>FID</FID>
        </OGRVRTLayer>
</OGRVRTDataSource>

The ODBC connection is to a SQL Express 2008 database. The PointData table
is defined as follows:

CREATE TABLE [dbo].[PointData](
 [PKey] [int] IDENTITY(1,1) NOT NULL,
 [Feature] [geometry] NULL,
 CONSTRAINT [PK_PointData] PRIMARY KEY CLUSTERED 
(
 [PKey] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

This query

select *, Feature.STAsText() from pointdata

yields

1 0x00000000010C0000000000C062400000000000C06240 POINT (150 150)

"ogrinfo test.ovf --debug on" runs for a very long time returning many lines
of this sort of stuff:

ERROR 4: Update access not supported for VRT datasources.
OGR_ODBC: EstablishSession(DSN:"CLO", userid:"un", password:"pw")
ODBC: SQLConnect(CLO)
ODBC: CatalogNameL: (null)
Schema name: (null)

OGR_ODBC: Table PointData has no identified FID column.
OGR_ODBC: Table UserMapData has no identified FID column.
OGR_ODBC: Table CHECK_CONSTRAINTS has no identified FID column.

before finally saying:

OGR: OGROpen(ODBC:un/pw at CLO/02C79D10) succeeded as ODBC.
ODBC: ExecuteSQL(select PKey as FID, Feature from PointData) called.
OGR_ODBC: Table SELECT has no identified FID column.
OGR: OGROpen(test.ovf/00E17090) succeeded as VRT.
Had to open data source read-only.
INFO: Open of `test.ovf'
      using driver `VRT' successful.
OGR: GetLayerCount() = 1

1: UserPoint
OGR: ReleaseDataSource(ODBC:sa/!Q2w3e4r at CLO/02C79D10) dereferenced and now
destroying.
ODBC: SQLDisconnect()

GDAL version is 1.6.0.

I have tried using no FID tag and using SrcLayer instead of SrcSQL. Anybody
know what I could do to make it see the FID? I'm guessing it would be a lot
faster if it didn't check every table in the database for an FID...

Thanks in advance for your assistance,

Dave Lowther

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/OGR-OVF-has-no-identified-FID-column-tp5441674p5441674.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list