Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] Upgrade the sample raster value algorithm to native C++
  • Loading branch information
nirvn committed Aug 17, 2020
1 parent 8aec98a commit d827faa
Show file tree
Hide file tree
Showing 10 changed files with 258 additions and 215 deletions.
5 changes: 0 additions & 5 deletions python/plugins/processing/algs/help/qgis.yaml
Expand Up @@ -300,11 +300,6 @@ qgis:rasterlayerhistogram: >

The raster layer must have a single band.

qgis:rastersampling: >
This algorithm creates a new vector layer with the same attributes of the input layer and the raster values corresponding on the point location.

If the raster layer has more than one band, all the band values are sampled.

qgis:regularpoints: >
This algorithm creates a point layer with a given number of regular points, all of them within a given extent.

Expand Down
2 changes: 0 additions & 2 deletions python/plugins/processing/algs/qgis/QgisAlgorithmProvider.py
Expand Up @@ -71,7 +71,6 @@
from .RandomSelectionWithinSubsets import RandomSelectionWithinSubsets
from .RasterCalculator import RasterCalculator
from .RasterLayerHistogram import RasterLayerHistogram
from .RasterSampling import RasterSampling
from .RectanglesOvalsDiamondsVariable import RectanglesOvalsDiamondsVariable
from .RegularPoints import RegularPoints
from .Relief import Relief
Expand Down Expand Up @@ -143,7 +142,6 @@ def getAlgs(self):
RandomSelectionWithinSubsets(),
RasterCalculator(),
RasterLayerHistogram(),
RasterSampling(),
RectanglesOvalsDiamondsVariable(),
RegularPoints(),
Relief(),
Expand Down
196 changes: 0 additions & 196 deletions python/plugins/processing/algs/qgis/RasterSampling.py

This file was deleted.

Expand Up @@ -14,61 +14,61 @@
<gml:featureMember>
<ogr:sampling_raster fid="sampling_points.0">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>18.6716225743775,45.8055955944047</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:rvalue_1>91.9159927368164</ogr:rvalue_1>
<ogr:SAMPLE_1>91.9159927368164</ogr:SAMPLE_1>
</ogr:sampling_raster>
</gml:featureMember>
<gml:featureMember>
<ogr:sampling_raster fid="sampling_points.1">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>18.6825918643183,45.8040506239905</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:rvalue_1>88.300178527832</ogr:rvalue_1>
<ogr:SAMPLE_1>88.300178527832</ogr:SAMPLE_1>
</ogr:sampling_raster>
</gml:featureMember>
<gml:featureMember>
<ogr:sampling_raster fid="sampling_points.2">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>18.6905484619515,45.7973300026888</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:rvalue_1>182.22380065918</ogr:rvalue_1>
<ogr:SAMPLE_1>182.22380065918</ogr:SAMPLE_1>
</ogr:sampling_raster>
</gml:featureMember>
<gml:featureMember>
<ogr:sampling_raster fid="sampling_points.3">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>18.6882310063302,45.7870559494343</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:rvalue_1>126.56761932373</ogr:rvalue_1>
<ogr:SAMPLE_1>126.56761932373</ogr:SAMPLE_1>
</ogr:sampling_raster>
</gml:featureMember>
<gml:featureMember>
<ogr:sampling_raster fid="sampling_points.4">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>18.6778024560343,45.7857427245822</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:rvalue_1>131.698287963867</ogr:rvalue_1>
<ogr:SAMPLE_1>131.698287963867</ogr:SAMPLE_1>
</ogr:sampling_raster>
</gml:featureMember>
<gml:featureMember>
<ogr:sampling_raster fid="sampling_points.5">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>18.6833643495254,45.7918453577183</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:rvalue_1>150</ogr:rvalue_1>
<ogr:SAMPLE_1>150</ogr:SAMPLE_1>
</ogr:sampling_raster>
</gml:featureMember>
<gml:featureMember>
<ogr:sampling_raster fid="sampling_points.6">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>18.6974235802947,45.8035871328663</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:rvalue_1>123.953346252441</ogr:rvalue_1>
<ogr:SAMPLE_1>123.953346252441</ogr:SAMPLE_1>
</ogr:sampling_raster>
</gml:featureMember>
<gml:featureMember>
<ogr:sampling_raster fid="sampling_points.7">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>18.6981188169811,45.7852019849373</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:rvalue_1>188.614822387695</ogr:rvalue_1>
<ogr:SAMPLE_1>188.614822387695</ogr:SAMPLE_1>
</ogr:sampling_raster>
</gml:featureMember>
<gml:featureMember>
<ogr:sampling_raster fid="sampling_points.8">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>18.6690733731941,45.7816485529846</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:rvalue_1>168.492599487305</ogr:rvalue_1>
<ogr:SAMPLE_1>168.492599487305</ogr:SAMPLE_1>
</ogr:sampling_raster>
</gml:featureMember>
<gml:featureMember>
<ogr:sampling_raster fid="sampling_points.9">
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>18.6707728406497,45.7915363636355</gml:coordinates></gml:Point></ogr:geometryProperty>
<ogr:rvalue_1>96.8800735473633</ogr:rvalue_1>
<ogr:SAMPLE_1>96.8800735473633</ogr:SAMPLE_1>
</ogr:sampling_raster>
</gml:featureMember>
</ogr:FeatureCollection>
Expand Up @@ -16,7 +16,7 @@
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/>
<xs:element name="rvalue_1" nillable="true" minOccurs="0" maxOccurs="1">
<xs:element name="SAMPLE_1" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:decimal">
</xs:restriction>
Expand Down
Expand Up @@ -866,7 +866,7 @@ tests:
- algorithm: qgis:rastersampling
name: Single band raster
params:
COLUMN_PREFIX: rvalue
COLUMN_PREFIX: SAMPLE_
INPUT:
name: custom/sampling_points.gml
type: vector
Expand Down
1 change: 1 addition & 0 deletions src/analysis/CMakeLists.txt
Expand Up @@ -134,6 +134,7 @@ SET(QGIS_ANALYSIS_SRCS
processing/qgsalgorithmrasterlayeruniquevalues.cpp
processing/qgsalgorithmrasterlogicalop.cpp
processing/qgsalgorithmrasterize.cpp
processing/qgsalgorithmrastersampling.cpp
processing/qgsalgorithmrasterstackposition.cpp
processing/qgsalgorithmrasterstatistics.cpp
processing/qgsalgorithmrastersurfacevolume.cpp
Expand Down

0 comments on commit d827faa

Please sign in to comment.