Opened 8 years ago
Closed 8 years ago
#3274 closed enhancement (wontfix)
v.net: allow connecting centroids when using option=arcs
Reported by: | mlennert | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.4.0 |
Component: | Vector | Version: | unspecified |
Keywords: | v.net centroids | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
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 ?
Attachments (1)
Change History (5)
follow-up: 2 comment:1 by , 8 years ago
comment:2 by , 8 years ago
Replying to 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
by , 8 years ago
Attachment: | v_net_centroid_type.diff added |
---|
patch to allow use of polygon centroids as nodes
comment:3 by , 8 years ago
Replying to 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...
comment:4 by , 8 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
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.
Shouldn't it be exposed to user as a parser option?