[GRASS5] Re: v.external FID problem: PostGIS/OGR

Frank Warmerdam fwarmerdam at gmail.com
Thu May 19 13:55:41 EDT 2005


On 5/18/05, Markus Neteler <neteler at itc.it> wrote:
> Hi,
> 
> I tried to connect to a PostGIS map which I created last year, but:
> 
> v.external   dsn="PG:host=myserver user=postgres dbname=spearfish" layer=streams output=pgstreams
> ERROR 1: ERROR:  Attribute "fid" not found
> 
> DBMI-OGR driver error:
> Cannot select:
> select FID from streams where FID = -1
> 
> Building topology ...
> WARNING: Random read is not supported by OGR for this layer, cannot build
>          support.

Markus, 

The above warning message is interesting.  I assume it is the grass
code that generates this?   I wonder how it is determining if OGR
supports random read.  It is quite possible that the TestCapabilities
is not returning the correct result if that is being used. 
 
> Here I found a reference to OGC_FID
> 
>  http://grass.itc.it/pipermail/grass5/2004-May/014395.html
>  http://www.gdal.org/ogr/drv_pg.html
>  "If there is an "ogc_fid" field, it will be used to set the feature
>   id of the features"
> 
> Obviously there is no ogc_fid column
> spearfish=# \d streams;
>            Table "public.streams"
>  Column |         Type          | Modifiers
> --------+-----------------------+-----------
>  cat    | integer               |
>  label  | character varying(10) |
> 
> but once v.external was functional (maybe dynamic creation of ogc_fid?).
> 
> Does anyone have insights if OGR changed?

I was going to write a big speel about _rowid_ and ogc_fid, but now
realize I am mixing up PostGIS support with SQLite which I was also
working on.  OGR might require the OGC_FID to do random reads
(fid based reads), and if the v.support stuff requires that you may well
be out of luck.

I don't think this aspect of OGR changed recently though.

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 grass-dev mailing list