[GRASS5] Re: [GRASSLIST:4351] Grass57 Vector attributes
Radim Blazek
blazek at itc.it
Fri Nov 5 06:46:45 EST 2004
I added a check to Vect_read_dblinks() for OGR formats.
The link to database is defined only if FID exists.
Unfortunately if FID is not available, the OGR DBMI driver
prints error and I don't know how to fix it.
Frank, how to create a table in postgres with "FID" column
which would be used by OGR as FID for features?
It seems that only "ogc_fid" is accepted as FID even if it
is not unique etc.
Would it be possible to accept also
integer/oid unique not null
columns as FID?
Radim
Frank Warmerdam wrote:
> Radim Blazek wrote:
>
>> On Wednesday 15 September 2004 13:36, Michael Holzmann wrote:
>>
>>> -with v.external now I make a Postgis-DB connection with the Layer
>>> state1. The geometry data are o.k. but the attributes doesn`t appear.
>>> The
>>> result of a query results in :
>>> Cannot open select cursor:`select*from
>>> state1 where FID=69` on database`PG:localhost....,
>>
>>
>>
>> Yes, bug and difficult to resolve I think. OGR layers use FID as link
>> to attributes. OGR SQL doc says:
>> (http://gdal.maptools.org/ogr/ogr_sql.html)
>>
>> | FID
>> | | Normally the feature id is a special property of a feature and not
>> treated | as an attribute of the feature. In some cases it is
>> convenient to be able | to utilize the feature id in queries and
>> result sets as a regular field. | To do so use the name FID. The field
>> wildcard expansions will not include | the feature id, but it may be
>> explicitly included using a syntax like:
>> | | SELECT FID, * FROM nation
>>
>> But for Postgres and other RDBMS, the query is probably passed to the
>> server, so the query fails, because FID field does not exist.
>>
>> Frank, how to get FID column name (pszFIDColumn, I believe)?
>
>
> Radim,
>
> There is no reliable way of doing this that would work accross different
> OGR drivers. FID is "special" and not necessarily an actual column.
>
> In fact, even for the PostGIS driver FID isn't necessarily a column. If
> no column can be assumed to be the FID one is just arbitrarily assigned
> as an offset index into the resultset.
>
> If you want a particular feature by feature id you can call the
> OGRLayer::GetFeature() method which takes the FID.
>
> Best regards,
>
More information about the grass-dev
mailing list