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

Moritz Lennert mlennert at club.worldonline.be
Thu Nov 9 10:23:52 EST 2006


Raffaele Morelli wrote:
> 2006/11/9, Moritz Lennert <mlennert at club.worldonline.be 
> <mailto:mlennert at club.worldonline.be>>:
> 
> 
>     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.
> 
>     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 '
> 
>     Do you have problems showing labels or querying the map ? 
> 
> 
> (...!!!...)  ok, this works. But now I have some questions about it.
> 
> "v.db.connect -o map=MyMap table=TABLE key=KeyCol driver=mysql 
> database=grass layer=2"
> this connects my map with a static table on layer 1

No, layer 2.

> 
> "v.db.connect -o map=MyMap table=NewView key=KeyCol driver=mysql 
> database=grass layer=1"
> this connects my map to the view
> 
> in this panorama, if I try to query (using gis manager) setting "Layer 
> for labels" = 2 and indicating the col field in the view I don't see 
> anything. Why? Am I missing something?

Probably you do not have any objects defined in layer 2.

see this thread to see if you don't have the same problem:

http://grass.itc.it/pipermail/grass5/2005-September/019592.html

If you want an object in your map to have layer 2 defined, you can 
either do this by hand in v.digit, or automatically with v.category:

v.category in=MyMap out=MyMap2 option=add layer=2

Moritz




More information about the grass-user mailing list