Bug report #21142

v.net.salesman sequence HTML output

Added by Pedro Venâncio over 5 years ago. Updated over 5 years ago.

Status:Closed
Priority:High
Assignee:Alexander Bruy
Category:Processing/GRASS
Affected QGIS version:3.4.4 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:28960

Description

v.net.salesman has the sequence parameter to show the optimal route to visit nodes on a vector network

https://grass.osgeo.org/grass76/manuals/v.net.salesman.html

In QGIS 2.x, this parameter was treated as an OutputTable:

https://github.com/qgis/QGIS/blob/release-2_18/python/plugins/processing/algs/grass7/description/v.net.salesman.txt#L13

Now in QGIS 3.4, sequence is treated as a QgsProcessingParameterFileDestination, in html:

https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/grass7/description/v.net.salesman.txt#L13

For this, sequence should be redirected as stdout

https://github.com/qgis/QGIS/blob/master/python/plugins/processing/algs/grass7/Grass7Algorithm.py#L632

but the grass_batch_job.cmd generated by v.net.salesman does not show the sequence=- parameter

chcp 1252>NUL
g.proj -c proj4="+proj=tmerc +lat_0=39.66825833333333 +lon_0=-8.133108333333334 +k=1 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs" 
v.in.ogr min_area=0.0001 snap=-1.0 input="D:\SIG\dados_exercicio_analise_redes\dados_exercicio\rede_viaria_distrito_porto_break.shp" output="vector_5c52dd7e6b0492" --overwrite -o
v.in.ogr min_area=0.0001 snap=-1.0 input="D:\SIG\dados_exercicio_analise_redes\dados_exercicio\campanha_museus_distrito_porto.shp" output="vector_5c52dd7e6b0493" --overwrite -o
g.region n=200265.16624542486 s=149098.80678702804 e=21170.13407058691 w=-54560.42845699884
v.net -s input=vector_5c52dd7e6b0492 points=vector_5c52dd7e6b0493 output=net5c52dd7e6bbf84 operation=connect threshold=250.0
v.db.connect -o map=net5c52dd7e6bbf84 table=vector_5c52dd7e6b0493 layer=2
v.net.salesman  input=net5c52dd7e6bbf84 arc_type="line,boundary" center_cats="1-100000" arc_column=tmpo_duplo arc_backward_column=tmpo_unico output=output5fa55aa089254a3ba02e31092108c33a > "C:/Users/pedro.venancio/AppData/Roaming/QGIS/QGIS3/profiles/default/processing/outputs/report.html" --overwrite
v.out.ogr type="line" input="output5fa55aa089254a3ba02e31092108c33a" output="C:/Users/pedro.venancio/AppData/Local/Temp/processing_4b1282aad2654406b36071e98ff7fd69/d5fa58be4358445287f4031b95114671/output.gpkg" format="GPKG" layer=1 --overwrite
exit

and the report.html file is empty.

The correct command should be

v.net.salesman  input=net5c52dd7e6bbf84 arc_type="line,boundary" center_cats="1-100000" arc_column=tmpo_duplo arc_backward_column=tmpo_unico output=output5fa55aa089254a3ba02e31092108c33a sequence=- > "C:/Users/pedro.venancio/AppData/Roaming/QGIS/QGIS3/profiles/default/processing/outputs/report.html" --overwrite

The same happens with v.net.report and v.net.nreport.

So, the sequence=- parameter needs to be passed to grass_batch_job.cmd.

Tested only in Windows, by now.

Associated revisions

Revision b9f559ee
Added by Alexander Bruy over 5 years ago

[processing] fix broken stdout handling in GRASS algs (fix #21142)

Revision 0a5bad43
Added by Alexander Bruy over 5 years ago

[processing] fix broken stdout handling in GRASS algs (fix #21142)

(cherry picked from commit b9f559ee0430e09d8e1a3b70e060155635080262)

History

#1 Updated by Giovanni Manghi over 5 years ago

  • Regression? changed from No to Yes

#2 Updated by Alexander Bruy over 5 years ago

  • Assignee set to Alexander Bruy
  • Status changed from Open to In Progress
  • Pull Request or Patch supplied changed from No to Yes

Fix included in #21142. BTW, this is more general issue and also happened with other algorithms which output results to HTML.

#3 Updated by Alexander Bruy over 5 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

#4 Updated by Alexander Bruy over 5 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF