[GRASS-dev] [GRASS GIS] #3274: v.net: allow connecting centroids when using option=arcs

#3274: v.net: allow connecting centroids when using option=arcs
-----------------------------+-------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: enhancement | Status: new
Priority: normal | Milestone: 7.4.0
Component: Vector | Version: unspecified
Keywords: v.net centroids | CPU: Unspecified
Platform: Unspecified |
-----------------------------+-------------------------
v.net with option arcs allows to connect pairs of points with lines.
However it does not allow connecting centroids. From what I can tell the
following small change would allow this:

{{{
Index: vector/v.net/arcs.c

--- vector/v.net/arcs.c (révision 70027)
+++ vector/v.net/arcs.c (copie de travail)
@@ -80,7 +80,7 @@
         list = Vect_new_list();

      /* find start node */
- Vect_cidx_find_all(Pnts, field, GV_POINT, cat, list);
+ Vect_cidx_find_all(Pnts, field, (GV_POINT | GV_CENTROID) , cat,
list);
      if (list->n_values < 1) {
         G_warning(_("No point with category %d found"), cat);
         return 0;
}}}

It works for me, but I'm not familiar enough with the module to be sure if
this is without negative consequences.

Any objections to committing this ?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3274&gt;
GRASS GIS <https://grass.osgeo.org>

#3274: v.net: allow connecting centroids when using option=arcs
--------------------------+-----------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.4.0
Component: Vector | Version: unspecified
Resolution: | Keywords: v.net centroids
       CPU: Unspecified | Platform: Unspecified
--------------------------+-----------------------------

Comment (by marisn):

Shouldn't it be exposed to user as a parser option?

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3274#comment:1&gt;
GRASS GIS <https://grass.osgeo.org>

#3274: v.net: allow connecting centroids when using option=arcs
--------------------------+-----------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.4.0
Component: Vector | Version: unspecified
Resolution: | Keywords: v.net centroids
       CPU: Unspecified | Platform: Unspecified
--------------------------+-----------------------------

Comment (by mlennert):

Replying to [comment:1 marisn]:
> Shouldn't it be exposed to user as a parser option?

You're absolutely right. And there might also be use cases for centroids
with op=connect.

Moritz

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3274#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#3274: v.net: allow connecting centroids when using option=arcs
--------------------------+-----------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.4.0
Component: Vector | Version: unspecified
Resolution: | Keywords: v.net centroids
       CPU: Unspecified | Platform: Unspecified
--------------------------+-----------------------------
Changes (by mlennert):

* Attachment "v_net_centroid_type.diff" added.

patch to allow use of polygon centroids as nodes

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3274&gt;
GRASS GIS <https://grass.osgeo.org>

#3274: v.net: allow connecting centroids when using option=arcs
--------------------------+-----------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: enhancement | Status: new
  Priority: normal | Milestone: 7.4.0
Component: Vector | Version: unspecified
Resolution: | Keywords: v.net centroids
       CPU: Unspecified | Platform: Unspecified
--------------------------+-----------------------------

Comment (by mlennert):

Replying to [ticket:3274 mlennert]:
> v.net with option arcs allows to connect pairs of points with lines.
However it does not allow connecting centroids.

I've just attached a patch that works for me, and that includes user
choice as a parameter. Both op=arcs and op=connect now work with
centroids.

I would appreciate if someone a bit more knowledgeable with the network
libraries could just have a look before I commit...

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3274#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#3274: v.net: allow connecting centroids when using option=arcs
--------------------------+-----------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: enhancement | Status: closed
  Priority: normal | Milestone: 7.4.0
Component: Vector | Version: unspecified
Resolution: wontfix | Keywords: v.net centroids
       CPU: Unspecified | Platform: Unspecified
--------------------------+-----------------------------
Changes (by mlennert):

* status: new => closed
* resolution: => wontfix

Comment:

After some offlist discussions with MarkusM, he convinced me that the need
to convert centroids to points is a good extra step to ensure that users
are conscious about what they are doing, knowing that centroids have
arbitrary coordinates, and their location thus have no real meaning.

Closing this as wontfix.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3274#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>