Bug report #10128

small bug in example script Extract_raster_values_to_shapefile.py and Extract_raster_values_to_CSV.py

Added by Sven Briels over 5 years ago. Updated over 4 years ago.

Status:Closed
Priority:Low
Assignee:Victor Olaya
Category:Processing/Core
Affected QGIS version:master Regression?:No
Operating System:windows 64bit Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:18588

Description

Hi guys,

just started working with QGIS. Found a small bug in the example scripts. Not sure where to submit it.

In line 113 of Extract_raster_values_to_shapefile.py and line 85 of Extract_raster_values_to_CSV.py:
" if rX > rasterXSize or rY > rasterYSize:"
should be replaced by:
" if rX >= rasterXSize or rY >= rasterYSize:"

otherwise the script crashes when we get data from the raster at a point at the boundary of the raster (e.g. if the raster is 200x200pix we can get values for 0-199 and 200 should be caught as exception).

good work, love qgis already. At the moment trying to build a little lidar plugin.

extract_raster_values_to_shapefile_edit.py Magnifier (3.95 KB) Sven Briels, 2014-04-28 05:32 AM

History

#1 Updated by Salvatore Larosa over 5 years ago

  • Tag set to easy
  • Category changed from Python plugins to 94
  • Affected QGIS version changed from 2.2.0 to master

Hi, you also can contribute by submitting a pull request
on github repository: https://github.com/qgis/QGIS, thanks.

#2 Updated by Paolo Cavallini over 5 years ago

  • Assignee set to Victor Olaya

#3 Updated by Antonio Locandro over 5 years ago

Corrected version is supplied, Sven have you made the pull request on Github or should someone else do it?

#4 Updated by Salvatore Larosa over 5 years ago

  • Status changed from Open to Closed
  • Resolution set to fixed/implemented

Fixed in 21da03e

#5 Updated by Giovanni Manghi over 4 years ago

  • Category changed from 94 to Processing/Core

Also available in: Atom PDF