[GRASS-user] sql and postgis

Moritz Lennert mlennert at club.worldonline.be
Tue Oct 30 14:32:17 EDT 2007


On 30/10/07 19:14, Gustavo Martinez wrote:
> El Tuesday 30 October 2007 15:00:30 escribió:
>> On 30/10/07 18:28, Gustavo Martinez wrote:
>>> El Monday 29 October 2007 12:53:20 escribió:
>>>>> Moritz,
>>>>>
>>>>> the result of  v.db.connect monitoreo -p is:
>>>>>
>>>>> Vector map <monitoreo> is connected by:
>>>>> layer <1> table <monitoreo> in database <PG:host=localhost
>>>>> dbname=pesca-new user=postgres> through driver <ogr> with key <>
>>>> There's the problem: 'with key <>'. GRASS does not know how to link the
>>>> geographical data (the map) to the attribute data. This is where the
>>>> SELECT FROM comes from, i.e., nothing to select.
>>>>
>>>> As I said, I'm not sure that a map linked into GRASS with v.external can
>>>> be used for database queries. Also don't know what the ogr driver
>>>> supports.
>>>>
>>>> You could try to relink the map directly to the postgresql table with
>>>> something like
>>>>
>>>> v.db.connect -o map=monitoreo driver=pg database="host=localhost
>>>> dbname=pesca-new" table=monitoreo key=XXX
>>>>
>>>> where XXX is the column that contains the identifiers of the
>>>> geographical objects in your map.
>>>>
>>>> Moritz
>>> I've tried the following command:
>>>
>>> v.db.connect -o map=monitoreo driver=pg database=pesca-new
>>> table=monitoreo key=idmonitoreo layer=1
>>>
>>>  and it gave me the following:
>>>
>>> pg driver: column 'fecha', type 1184  is not supported
>>> pg driver: column 'fch_local', type 1184  is not supported
>>> pg driver: PostGIS column 'geom', type 'geometry'  will not be converted
>>> pg driver: column 'fecha', type 1184  is not supported
>>> pg driver: column 'fch_local', type 1184  is not supported
>>> pg driver: PostGIS column 'geom', type 'geometry'  will not be converted
>>>
>>> The table <monitoreo> is now part of vector map <monitoreo> and may be
>>> deleted or overwritten by GRASS modules
>>>
>>> However, if I tgry again
>>> v.db.connect monitoreo -p the key field is still empty.
>> What is the output of v.db.connect -p ?
>>
>> I'm not sure I can help you any further, but my guess would be that
>> there is a difference in the handling of maps linked via v.external
>> compared to maps which are imported into GRASS...
>>
>> Moritz
> 
> 
> the result of  v.db.connect monitoreo -p is:
> 
> Vector map <monitoreo> is connected by:
> layer <1> table <monitoreo> in database <PG:host=localhost
> dbname=pesca-new user=postgres> through driver <ogr> with key <>

So v.db.connect -o actually did not work (driver is still ogr).

I would recommend that you import the map into GRASS with v.in.ogr, do 
what you have to there and then export it again to PostGIS with v.out.ogr.

Moritz




More information about the grass-user mailing list