[GRASS-user] How to JOIN a table to vector layer using MySQL

Moritz Lennert mlennert at club.worldonline.be
Thu Nov 9 08:58:55 EST 2006


Raffaele Morelli wrote:
> 
> 
> 2006/11/9, Moritz Lennert <mlennert at club.worldonline.be 
> <mailto:mlennert at club.worldonline.be>>:
> 
>     Raffaele Morelli wrote:
>       > The solution would be to work with views.
>      > Grass sees views, connects to views and this is wonderful, but...
>     more
>      > it would be if it could handle them correctly. I tried to link to
>     views
>      > but quering on the attributes doesn't work correctly.
> 
>     I use views successfully quite often with the postgres driver. Could you
>     be more specific about what does not work for you ?
> 
>     Moritz
> 
> 
> With grass6.0 on a debian testing I connect succesfully to views.
> The problem arise when trying to query the layer connected to the view, 
> it doesn't display (e.g. label) fields stored in the view or retrieve 
> any information from there.
> 
> It seems just like "Layer for labels" and "Layer for query" text box in 
> the Gis Manager doesn't work properly with views, sometimes they simply 
> ignore my SQL statements or retrieve incorrect values.

This might be an issue with layers, not with your view.
How do you use the layers ? Layers can be quite complex to understand 
and there has been much discussion on them.

See here for a very short intro
http://www.grass.itc.it/grass63/manuals/html63_user/vectorintro.html 
(section attribute management)

Have you tried connecting to a view without changing layers, i.e.:

- take a map MyMap for which you have a table MapTable in your database
- create a view with "create view NewView as select * from MapTable"
- connect your map to this view with 'v.db.connect -o map=MyMap 
table=NewView key=KeyCol'

Do you have problems showing labels or querying the map ?

Moritz




More information about the grass-user mailing list