Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] v.net.visibility doesn't use the additional points coords when the visibility option is present #1335

Closed
agiudiceandrea opened this issue Feb 14, 2021 · 2 comments · Fixed by #1336
Labels
bug Something isn't working
Milestone

Comments

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Feb 14, 2021

Describe the bug
According to the docs, v.net.visibility should work in three modes:

  1. v.net.visibility input=input_layer output=graph -> computes the visibility graph between points/vertices of input_layer
  2. v.net.visibility input=input_layer coordinates=x1,y1,x2,y2,... output=graph -> computes the visibility graph between points/vertices of input_layer plus the additional (x1,y1), (x2,y2), ... points
  3. v.net.visibility input=input_layer coordinates=x1,y1,x2,y2,... visibility=old_graph output=new_graph -> copies the previously computed visibility graph and then computes only additional visibility graph between points/vertices of input_layer and the additional (x1,y1), (x2,y2), ... extra points

While modes 1 and 2 seems to work well, mode 3 seems not working properly: the new output graph (new_graph) is always identical to the previously computed visibility graph (old_graph) specified with the visibility parameter as it seems that the coordinates of the point specified with the coordinates parameter are not taken into account.

To Reproduce
Steps to reproduce the behavior:

Follow Example 4 in v.net.visibility docs:

v.extract input=zipcodes_wake output=areas_7_11_25 cats=7,11,25
g.region vector=zipcodes_wake
d.mon wx0
d.vect areas_7_11_25
v.net.visibility input=areas_7_11_25 output=graph
v.net.visibility input=areas_7_11_25 visibility=graph output=new_graph \
      coordinates=669547.97,208348.20

Expected behavior
The vector map graph is computed then a new visibility graph is computed from it with the extra point 669547.97,208348.20

System description (please complete the following information):

  • Operating System: Windows
  • GRASS GIS version 7.8.5

Additional context

It seems to me there is a flaw in the module logic:
in the main function the n int variable is initially set to 0

then the variable n is not properly set to the number of additional extra points (specified with the "coordinates" parameter) before the visibility_points function is called:

visibility_points(points, num_points, lines, num_lines, &out, n);

so the outermost loop in the visibility_points function is never performed:
/* loop through the points to add */
for (i = 0; i < n; i++) {

Maybe @mmaldacker could give better insights.

@ninsbl
Copy link
Member

ninsbl commented May 6, 2021

Should #1336 be backported?

@ninsbl ninsbl reopened this May 6, 2021
@neteler
Copy link
Member

neteler commented May 6, 2021

Backport for 7.8.6 done

@neteler neteler closed this as completed May 6, 2021
@neteler neteler added this to the 7.8.6 milestone May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants