<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Thank you both for your suggestions. I found another way around this. My goal was to generate a topologically valid vector (POLYGON) layer containing stand as a predicate of strata (all stands exist within a strata, no stand overlaps strata). To achieve this, I used v.what.rast using centroid after converting the strata raster to polygons with the strata as a mask. Then I remove the mask and patch all the strata polygons with stand attributes together to create a table containing all strata. <div class=""><br class=""></div><div class="">pseudocode:</div><div class=""><br class=""></div><div class="">for all S in STRATA:</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>create mask using S</div><div class=""><span class="Apple-tab-span" style="white-space:pre">       </span>r.to.vect area — a polygon layer reflecting stands within the strata </div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>v.db.acccolumn ‘strata’ — create a new column to store strata values</div><div class=""><span class="Apple-tab-span" style="white-space:pre">        </span>v.what.rast raster=STRATA — add the strata attribute to the polygon</div><div class=""><br class=""></div><div class="">v.patch all S from above..</div><div class=""><br class=""></div><div class="">Now I have another issue, though. Will post to a different thread.</div><div class=""><br class=""></div><div class="">Thank you again,</div><div class=""><br class=""></div><div class="">Peter</div><div class=""> <br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Dec 7, 2017, at 7:00 AM, Markus Metz <<a href="mailto:markus.metz.giswork@gmail.com" class="">markus.metz.giswork@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class=""><br class=""><br class="">On Thu, Dec 7, 2017 at 3:20 PM, Moritz Lennert <<a href="mailto:mlennert@club.worldonline.be" class="">mlennert@club.worldonline.be</a>> wrote:<br class="">><br class="">><br class="">><br class="">> Am 7. Dezember 2017 14:42:38 MEZ schrieb Markus Metz <<a href="mailto:markus.metz.giswork@gmail.com" class="">markus.metz.giswork@gmail.com</a>>:<br class="">> >On Thu, Dec 7, 2017 at 9:21 AM, Moritz Lennert<br class="">> ><<a href="mailto:mlennert@club.worldonline.be" class="">mlennert@club.worldonline.be</a>><br class="">> >wrote:<br class="">> >><br class="">> >><br class="">> >><br class="">> >> Am 6. Dezember 2017 19:45:49 MEZ schrieb Peter Tittmann <<br class="">> ><a href="mailto:ptittmann@gmail.com" class="">ptittmann@gmail.com</a>>:<br class="">> >> >Moritz,<br class="">> >> ><br class="">> >> >v.db.connect -p c34_patch<br class="">> >> >Vector map <c34_patch> is connected by:<br class="">> >> >layer <1/c34_patch> table <c34_patch> in database<br class="">> >> ></Users/pete/grassdata/<FOO>/project_area/sqlite/sqlite.db> through<br class="">> >> >driver <sqlite> with key <cat><br class="">> >> ><br class="">> >> >So it seems that only layer 1 is connected.<br class="">> >> ><br class="">> >> >When try to connect layer 2:<br class="">> >> ><br class="">> >> >v.db.connect map=c34_patch@project_area table=c34_patch layer=2<br class="">> >> >ERROR: Use -o to overwrite existing link for layer <2><br class="">> >><br class="">> >> This is weird. This message normally only comes when there really is<br class="">> >a<br class="">> >connection defined for this layer:<br class="">> ><br class="">> >The reason for the error could be that the table c34_patch is already<br class="">> >attached to layer 1.<br class="">><br class="">> In my NC data example you can see that it works as expected when attaching layer 2 to the same table as layer 1.<br class=""><br class=""></div>OK, I see.<br class=""><div class=""><br class="">><br class="">> ><br class="">> >I guess what is needed here is v.db.addtable map=c34_patch layer=2<br class="">><br class="">> v.db.addtable will create a new, empty table containing only the vector features' cat values. In the OP, Peter indicated that he had two layers with respective attribute tables, containing the attributes Strata and Stand.</div><div class=""><br class=""></div><div class="">In the OP, it says</div><div class=""><br class=""></div><div class=""><div class="">c34_patch@project_area: </div><div class="">  Type: Point</div><div class="">  Id: 21622</div><div class="">  Layer: 1</div><div class="">  Category: 21623</div><div class="">  Driver: sqlite</div><div class="">  Database: /Users/pete/grassdata/<wbr class="">PortGraham/project_area/<wbr class="">sqlite/sqlite.db</div><div class="">  Table: c34_patch</div><div class="">  Key_column: cat</div><div class="">  Attributes: </div><div class="">    cat: 21623</div><div class="">    <b class="">strata: 3  — STRATA</b></div></div><div class=""><div class="">c34_patch@project_area: </div><div class="">  Type: Point</div><div class="">  Id: 21622</div><div class="">  Layer: 2</div><div class="">  <b class="">Category: 10  — STAND</b></div></div><div class=""><br class=""></div><div class="">--> no attributes in layer 2, only categories in layer 2. IIUC, the attribute 'strata' from layer 1 must be combined with the category value from layer 2. Your suggestion should work, after a new table has been added to layer 2.<br class=""></div><div class=""><br class=""></div><div class="">Markus M<br class=""></div><div class=""><br class=""></div><div class="">> Unless these two attributes are included in the two layers as the respective category values, I don't think v.db.addtable will help.<br class="">><br class="">> But that's why we need more info...<br class="">><br class="">> Moritz<br class="">><br class="">><br class="">> ><br class="">> >Now you could proceed as suggested by Moritz:<br class="">> ><br class="">> >- Create a new column in layer 1 where you can put the info from layer<br class="">> >2<br class="">> >- Fill this column with v.to.db option=query query_layer=2, etc<br class="">> >- Create a second new column to hold the concatenation<br class="">> >- v.db.update to update this new column with the concatenation of the<br class="">> >two<br class="">> >others (something like qcol = "STRATA || '_' || STAND")<br class="">> ><br class="">> >Markus M<br class="">> ><br class="">> >><br class="">> >> GRASS 7.2.2 (nc_spm_08):~ > g.copy v=hospitals,test<br class="">> >> Copy vector <hospitals@PERMANENT> to current mapset as<br class="">> >> <test><br class="">> >>  GRASS 7.2.2 (nc_spm_08):~ > v.db.connect -p test<br class="">> >> Vector map <test> is connected by:<br class="">> >> layer <1/hospitals> table <test> in database<br class="">> ></data/home/mlennert/GRASSDATA/nc_spm_08/user1/sqlite/sqlite.db><br class="">> >> through driver <sqlite> with key <cat><br class="">> >> GRASS 7.2.2 (nc_spm_08):~ > v.db.connect test layer=2 table=test<br class="">> >> The table <test> is now part of vector map <test> and may be deleted<br class="">> >or<br class="">> >> overwritten by GRASS modules<br class="">> >> Select privileges were granted on the table<br class="">> >> GRASS 7.2.2 (nc_spm_08):~ > v.db.connect -p test<br class="">> >> Vector map <test> is connected by:<br class="">> >> layer <1/hospitals> table <test> in database </data/hom<br class="">> >> e/mlennert/GRASSDATA/nc_spm_08/user1/sqlite/sqlite.db><br class="">> >> through driver <sqlite> with key <cat><br class="">> >> layer <2/test> table <test> in database<br class="">> ></data/home/mlennert/GRASSDATA/nc_spm_08/user1/sqlite/sqlite.db><br class="">> >through<br class="">> >driver <sqlite> with key <cat><br class="">> >> GRASS 7.2.2 (nc_spm_08):~ > v.db.connect test layer=2 table=test<br class="">> >> ERROR: Use -o to overwrite existing link for layer <2><br class="">> >><br class="">> >> So I don't really understand why you get the error message...<br class="">> >><br class="">> >> ><br class="">> >> >I’m little unclear on the ‘table’ argument, maybe that should be a<br class="">> >now<br class="">> >> >table?<br class="">> >><br class="">> >> Although there might be situations where one could want to connect<br class="">> >two<br class="">> >layers to the same table, generally each layer is connected to a<br class="">> >different<br class="">> >table.<br class="">> >><br class="">> >> In your original post you said the vector had two layers with<br class="">> >attributes.<br class="">> >This does not seem to be the case when I see the v.db.connect -p<br class="">> >output.<br class="">> >Maybe if you go a bit back and explain to us in what format the<br class="">> >original<br class="">> >data is and how you imported it, this might help us help you.<br class="">> >><br class="">> >> Moritz<br class="">> >><br class="">> >> ><br class="">> >> >Thanks very much.<br class="">> >> ><br class="">> >> >Peter<br class="">> >> >> On Dec 6, 2017, at 10:27 AM, Moritz Lennert<br class="">> >> ><<a href="mailto:mlennert@club.worldonline.be" class="">mlennert@club.worldonline.be</a>> wrote:<br class="">> >> >><br class="">> >> >><br class="">> >> >><br class="">> >> >> Am 6. Dezember 2017 18:42:22 MEZ schrieb Peter Tittmann<br class="">> >> ><<a href="mailto:ptittmann@gmail.com" class="">ptittmann@gmail.com</a> <mailto:<a href="mailto:ptittmann@gmail.com" class="">ptittmann@gmail.com</a>>>:<br class="">> >> >>> Thank you, Moritz.<br class="">> >> >>><br class="">> >> >>> I'm pretty familiar with SQL but can’t figure out how layer 2 is<br class="">> >> >stored<br class="">> >> >>> in the database. When I `pragma table_info(<vector>)` I only see<br class="">> >the<br class="">> >> >>> layer 1 attributes.<br class="">> >> >><br class="">> >> >> v.db.connect -p (or grass.script.vector_db() )will show you all<br class="">> >> >connections between the map and database tables.<br class="">> >> >><br class="">> >> >><br class="">> >> >> Moritz<br class="">> >> >>><br class="">> >> >>> I’ll work with the GRASS approach you suggested.<br class="">> >> >>><br class="">> >> >>> Best,<br class="">> >> >>> Peter<br class="">> >> >>><br class="">> >> >>><br class="">> >> >>>> On Dec 1, 2017, at 11:53 PM, Moritz Lennert<br class="">> >> >>> <<a href="mailto:mlennert@club.worldonline.be" class="">mlennert@club.worldonline.be</a>> wrote:<br class="">> >> >>>><br class="">> >> >>>> On 02/12/17 02:03, Peter Tittmann wrote:<br class="">> >> >>>>> Hi,<br class="">> >> >>>>> I have a vector (`POINT`) which has two layers containing<br class="">> >relevant<br class="">> >> >>> attributes (’strata’ and ’stand’). I would like to concatenate<br class="">> >the<br class="">> >> >two<br class="">> >> >>> values into a new attribute for Layer 1 (’<STRATA>_<STAND>’).<br class="">> >I’ve<br class="">> >> >been<br class="">> >> >>> struggling to sort this out for too long and am tapping out. Its<br class="">> >> >>> probably blatantly obvious but it has escaped me.<br class="">> >> >>>><br class="">> >> >>>><br class="">> >> >>>> Probably the easiest way if your not very familiar with SQL:<br class="">> >> >>>><br class="">> >> >>>> - Create a new column in layer 1 where you can put the info from<br class="">> >> >>> layer 2<br class="">> >> >>>> - Fill this column with v.to.db option=query query_layer=2, etc<br class="">> >> >>>> - Create a second new column to hold the concatenation<br class="">> >> >>>> - v.db.update to update this new column with the concatenation<br class="">> >of<br class="">> >> >the<br class="">> >> >>> two others (something like qcol = "STRATA || '_' || STAND")<br class="">> >> >>>><br class="">> >> >>>> Otherwise, if there is a common key in both tables, you can just<br class="">> >> >>> create a new column and use db.execute to launch a UPDATE TABLE<br class="">> >> >>> directly, grabbing the info from the two table and concatenating<br class="">> >it<br class="">> >> >>> directly in the query.<br class="">> >> >>>><br class="">> >> >>>> Moritz<br class="">> >> >>>><br class="">> >> >>>><br class="">> >> >>>>> Thank you!<br class="">> >> >>>>> Here are some specifics.<br class="">> >> >>>>> east, north: 651849.842735, 6604949.78485<br class="">> >> >>>>> c34_patch@project_area:<br class="">> >> >>>>>  Type: Point<br class="">> >> >>>>>  Id: 21622<br class="">> >> >>>>>  Layer: 1<br class="">> >> >>>>>  Category: 21623<br class="">> >> >>>>>  Driver: sqlite<br class="">> >> >>>>>  Database:<br class="">> >> >>> /Users/pete/grassdata/PortGraham/project_area/sqlite/sqlite.db<br class="">> >> >>>>>  Table: c34_patch<br class="">> >> >>>>>  Key_column: cat<br class="">> >> >>>>>  Attributes:<br class="">> >> >>>>>    cat: 21623<br class="">> >> >>>>> *strata: 3  — STRATA*<br class="">> >> >>>>> c34_patch@project_area:<br class="">> >> >>>>>  Type: Point<br class="">> >> >>>>>  Id: 21622<br class="">> >> >>>>>  Layer: 2<br class="">> >> >>>>> *Category: 10  — STAND*<br class="">> >> >>>>> _______________________________________________<br class="">> >> >>>>> grass-user mailing list<br class="">> >> >>>>> <a href="mailto:grass-user@lists.osgeo.org" class="">grass-user@lists.osgeo.org</a> <mailto:<a href="mailto:grass-user@lists.osgeo.org" class="">grass-user@lists.osgeo.org</a>><br class="">> >> ><mailto:<a href="mailto:grass-user@lists.osgeo.org" class="">grass-user@lists.osgeo.org</a><br class="">> ><mailto:<a href="mailto:grass-user@lists.osgeo.org" class="">grass-user@lists.osgeo.org</a>>><br class="">> >> >>>>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-user" class="">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br class="">> >> ><<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" class="">https://lists.osgeo.org/mailman/listinfo/grass-user</a>><br class="">> >> >>> <<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" class="">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br class="">> >> ><<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" class="">https://lists.osgeo.org/mailman/listinfo/grass-user</a>>><br class="">> >> _______________________________________________<br class="">> >> grass-user mailing list<br class="">> >> <a href="mailto:grass-user@lists.osgeo.org" class="">grass-user@lists.osgeo.org</a><br class="">> >> <a href="https://lists.osgeo.org/mailman/listinfo/grass-user" class="">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br class=""><br class=""></div></div>
</div></blockquote></div><br class=""></div></body></html>