[GRASS5] Re: v.external FID problem: PostGIS/OGR
Radim Blazek
blazek at itc.it
Fri May 20 04:00:54 EDT 2005
Frank Warmerdam wrote:
> 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.
Yes, it is using OGR_L_TestCapability, but to work properly the FID
should be persistent which probably is not true for PostGIS as mentioned
in the link below.
>>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.
Would it be possible to support also OID, which is created by default,
so many people use it.
Radim
> I don't think this aspect of OGR changed recently though.
>
> Best regards,
More information about the grass-dev
mailing list