<div dir="ltr"><div>All,</div><div><div><br></div><div>Please review <a href="https://github.com/OSGeo/grass/pull/3508">https://github.com/OSGeo/grass/pull/3508</a>. It should fix non-continuous cats.</div><div><br></div><div>Thanks,</div><div>Huidae<br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 15, 2024 at 10:37 AM Vincent Bain via grass-user <<a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Michael, Huidae<br>
<br>
thats's what I was just about to post... you need to care cats<br>
intervals don't overlap before patching.<br>
<br>
With the attached set of 2 vector maps you can have a try, typing :<br>
<br>
v.in.ogr input=/your/path/to/map1.gpkg output=map1<br>
v.in.ogr input=/your/path/to/map2.gpkg output=map2<br>
v.category input=map1 type=centroid option=report<br>
v.category input=map2 type=centroid option=report<br>
# Cats overlap, so :<br>
v.category --overwrite input=map2 type=centroid output=map200<br>
option=sum cat=100<br>
v.patch --overwrite input=map1,map200 output=map12<br>
v.patch -e --overwrite input=map1,map200 output=map12<br>
<br>
Yours,<br>
V.<br>
<br>
Le vendredi 15 mars 2024 à 09:51 -0600, Huidae Cho a écrit :<br>
> Michael,<br>
> <br>
> Just confirmed your issue.<br>
> <br>
> v.random tmp100 npoints=100 seed=100<br>
> v.db.addtable tmp100 col="id varchar(20)"<br>
> v.db.update tmp100 col=id qcol="'tmp100_' || cat"<br>
> <br>
> v.random tmp10 npoints=10 seed=10<br>
> v.db.addtable tmp10 col="id varchar(20)"<br>
> v.db.update tmp10 col=id qcol="'tmp10_' || cat"<br>
> <br>
> v.patch tmp100,tmp10 out=tmp110 -e<br>
> <br>
> v.category tmp110 op=report<br>
> Layer/table: 1/tmp110<br>
> type count min max<br>
> point 110 2 112<br>
> line 0 0 0<br>
> boundary 0 0 0<br>
> centroid 0 0 0<br>
> area 0 0 0<br>
> face 0 0 0<br>
> kernel 0 0 0<br>
> all 110 2 112<br>
> <br>
> In my case, all features in tmp10 are linked in tmp110.<br>
> <br>
> You can recategorize it.<br>
> <br>
> v.category tmp110 out=tmp110_nocats op=del cat=-1<br>
> v.category tmp110_nocats out=tmp110_recats op=add<br>
> <br>
> npnts100=$(<a href="http://v.info" rel="noreferrer" target="_blank">v.info</a> tmp100 -t | sed '/points=/!d; s/points=//')<br>
> npnts10=$(<a href="http://v.info" rel="noreferrer" target="_blank">v.info</a> tmp10 -t | sed '/points=/!d; s/points=//')<br>
> <br>
> v.db.update tmp110_recats col=cat qcol=cat-1 where="cat<=$npnts100+1"<br>
> v.db.update tmp110_recats col=cat qcol=cat-2 where="cat>$npnts100+1"<br>
> <br>
> Yeah... I know what you may think... Please create an issue on<br>
> GitHub.<br>
> <br>
> Regards,<br>
> Huidae<br>
> <br>
> On Thu, Mar 14, 2024 at 4:42 PM Michael Barton via grass-dev<br>
> <<a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a>> wrote:<br>
> > Thanks Doug and Vincent. <br>
> > <br>
> > None of this works. I vaguely remember having this same kind of<br>
> > road block several years back. <br>
> > <br>
> > Nothing in v.category lets you change an existing cat value to a<br>
> > different value<br>
> > v.in.ogr MUST add a column that MUST be named cat (all else causes<br>
> > an error--this is a bug) that is a series of consecutive integers<br>
> > from 1-n. So I cannot create a file with a cat field that matches<br>
> > my vector areas. <br>
> > <br>
> > v.edit won't let you change an existing cat number AFAICT. No error<br>
> > but nothing changes. <br>
> > <br>
> > Once I've imported a table using v.in.ogr, I cannot use<br>
> > db.drop.column to delete the cat column--even if it is not being<br>
> > used as a key field. This raises an error.<br>
> > <br>
> > No way to rename a column from cat to something else (or something<br>
> > else to cat) unless you've already connected it to a vector map<br>
> > even if cat is not the key field. So I can't create an integer<br>
> > column to link up my lost vector area with a record in my csv<br>
> > file. <br>
> > <br>
> > This simple task is just not possible in GRASS AFAICT. Or if it is<br>
> > possible, it can only be done by such non-obvious and convoluted<br>
> > means that I've yet to find a method that works in spite of asking<br>
> > a large number of very skilled GRASS users.<br>
> > <br>
> > Michael<br>
> > _____________________________<br>
> > C. Michael Barton<br>
> > Associate Director, School of Complex Adaptive<br>
> > Systems (<a href="https://scas.asu.edu" rel="noreferrer" target="_blank">https://scas.asu.edu</a>)<br>
> > Professor, School of Human Evolution & Social<br>
> > Change (<a href="https://shesc.asu.edu" rel="noreferrer" target="_blank">https://shesc.asu.edu</a>)<br>
> > Director, Center for Social Dynamics &<br>
> > Complexity (<a href="https://complexity.asu.edu" rel="noreferrer" target="_blank">https://complexity.asu.edu</a>)<br>
> > Arizona State University<br>
> > Tempe, AZ 85287-2701<br>
> > USA<br>
> > <br>
> > Executive Director, Open<br>
> > Modeling Foundation (<a href="https://openmodelingfoundation.github.io" rel="noreferrer" target="_blank">https://openmodelingfoundation.github.io</a>)<br>
> > Director, Network for Computational Modeling in Social & Ecological<br>
> > Sciences (<a href="https://comses.net" rel="noreferrer" target="_blank">https://comses.net</a>)<br>
> > <br>
> > personal website: <a href="http://www.public.asu.edu/~cmbarton" rel="noreferrer" target="_blank">http://www.public.asu.edu/~cmbarton</a> <br>
> > <br>
> > <br>
> > > On Mar 14, 2024, at 7:10 AM, Newcomb, Doug <<a href="mailto:doug_newcomb@fws.gov" target="_blank">doug_newcomb@fws.gov</a>><br>
> > > wrote:<br>
> > > <br>
> > > Have you tried a .csvt file for your .csv<br>
> > > file? <a href="https://gdal.org/drivers/vector/csv.html" rel="noreferrer" target="_blank">https://gdal.org/drivers/vector/csv.html</a><br>
> > > <br>
> > > From: grass-dev <<a href="mailto:grass-dev-bounces@lists.osgeo.org" target="_blank">grass-dev-bounces@lists.osgeo.org</a>> on behalf of<br>
> > > Michael Barton via grass-dev <<a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a>><br>
> > > Sent: Wednesday, March 13, 2024 7:02 PM<br>
> > > To: GRASS developers <<a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a>>; GRASS user list<br>
> > > <<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a>><br>
> > > Subject: [EXTERNAL] [GRASS-dev] vector patching frustration <br>
> > > <br>
> > > This email has been received from outside of DOI - Use caution<br>
> > > before clicking on links, opening attachments, or responding. <br>
> > > <br>
> > > <br>
> > > I am completely stymied in my attempt to do what should be a<br>
> > > simple task. I have a map of vector areas, linked with an<br>
> > > attribute table. I would like to patch in one more vector area,<br>
> > > for which I have equivalent attribute information. I have tried<br>
> > > this multiple ways and I cannot make this patch happen so that<br>
> > > the added area has attribute info. <br>
> > > <br>
> > > The closest I've come is to create and link a one line table to<br>
> > > the new area that has exactly the same fields as the larger<br>
> > > vector area map. The first map has 154 areas (i.e., cat=1-155).<br>
> > > When I patch the maps and look at the resulting attribute table,<br>
> > > I indeed see line and cat 155. But it is not linked with the<br>
> > > patched area--which has been assigned a cat=183 for reasons I<br>
> > > cannot fathom. The patch also renumbers my cat field to cat=2-155<br>
> > > from the original 1-154. <br>
> > > <br>
> > > This has been made more complicated by the fact that v.in.ogr<br>
> > > imports all columns of a *.csv as text, regardless of what is in<br>
> > > them and assigns cat numbers starting at 1. So I can't specify an<br>
> > > integer key field of 155 to try the linking. Nor can I change the<br>
> > > assigned cat of the single area I am trying to patch from 1 to<br>
> > > 155 using v.category (or anything else I can find). <br>
> > > <br>
> > > I'm hoping that someone has a clever solution that I've not seen<br>
> > > or I'll just have to do this fairly simple and straightforward<br>
> > > vector operation in QGIS. <br>
> > > <br>
> > > Michael<br>
> > > _____________________________<br>
> > > C. Michael Barton<br>
> > > Associate Director, School of Complex Adaptive<br>
> > > Systems (<a href="https://scas.asu.edu" rel="noreferrer" target="_blank">https://scas.asu.edu</a>)<br>
> > > Professor, School of Human Evolution & Social<br>
> > > Change (<a href="https://shesc.asu.edu" rel="noreferrer" target="_blank">https://shesc.asu.edu</a>)<br>
> > > Director, Center for Social Dynamics &<br>
> > > Complexity (<a href="https://complexity.asu.edu" rel="noreferrer" target="_blank">https://complexity.asu.edu</a>)<br>
> > > Arizona State University<br>
> > > Tempe, AZ 85287-2701<br>
> > > USA<br>
> > > <br>
> > > Executive Director, Open<br>
> > > Modeling Foundation (<a href="https://openmodelingfoundation.github.io" rel="noreferrer" target="_blank">https://openmodelingfoundation.github.io</a>)<br>
> > > Director, Network for Computational Modeling in Social &<br>
> > > Ecological Sciences (<a href="https://comses.net" rel="noreferrer" target="_blank">https://comses.net</a>)<br>
> > > <br>
> > > personal website: <a href="http://www.public.asu.edu/~cmbarton" rel="noreferrer" target="_blank">http://www.public.asu.edu/~cmbarton</a><br>
> > <br>
> > _______________________________________________<br>
> > grass-dev mailing list<br>
> > <a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a><br>
> > <a href="https://lists.osgeo.org/mailman/listinfo/grass-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-dev</a><br>
> <br>
> <br>
> -- <br>
> Huidae Cho, Ph.D., GISP, /hidɛ t͡ɕo/, 조희대, 曺喜大<br>
> GRASS GIS Developer<br>
> <a href="https://idea.isnew.info/" rel="noreferrer" target="_blank">https://idea.isnew.info/</a><br>
_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/grass-user</a><br>
</blockquote></div><br clear="all"><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><span><div><div dir="ltr">Huidae Cho, Ph.D., GISP, /<a href="http://ipa-reader.xyz/?text=hid%C9%9B" target="_blank">hidɛ</a> t͡ɕo/, 조희대, 曺喜大</div><div dir="ltr">GRASS GIS Developer</div><div><a href="https://idea.isnew.info/" target="_blank">https://idea.isnew.info/</a><br></div></div></span></div></div></div></div></div></div></div></div></div></div>