Skip to content

Commit cef9c4e

Browse files
committed
[FEATURE][processing] New algorithms "Extract Z values" and "Extract m values"
These algorithms allow users to convert z or m values present in feature geometries to attributes in the layer. By default the z/m value from the first vertex in the feature is extracted, but optionally statistics can be calculated on ALL the z/m values from the geometry (e.g. calculating mean/min/max/sum/etc of z values).
1 parent e99072b commit cef9c4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+545
-0
lines changed
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]
Binary file not shown.
Binary file not shown.

python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml

+172
Original file line numberDiff line numberDiff line change
@@ -6430,6 +6430,178 @@ tests:
64306430
name: expected/force_rhr_multipolys.gml
64316431
type: vector
64326432

6433+
- algorithm: native:extractzvalues
6434+
name: Extract z, first value only
6435+
params:
6436+
COLUMN_PREFIX: z_
6437+
INPUT:
6438+
name: lines_z.shp
6439+
type: vector
6440+
SUMMARIES:
6441+
- 0
6442+
results:
6443+
OUTPUT:
6444+
name: expected/extract_z_first.shp
6445+
type: vector
6446+
6447+
- algorithm: native:extractzvalues
6448+
name: Extract z, all stats
6449+
params:
6450+
COLUMN_PREFIX: zs_
6451+
INPUT:
6452+
name: lines_z.shp
6453+
type: vector
6454+
SUMMARIES:
6455+
- 0
6456+
- 1
6457+
- 2
6458+
- 3
6459+
- 4
6460+
- 5
6461+
- 6
6462+
- 7
6463+
- 8
6464+
- 9
6465+
- 10
6466+
- 11
6467+
- 12
6468+
- 13
6469+
- 14
6470+
- 15
6471+
results:
6472+
OUTPUT:
6473+
name: expected/extract_z_all.shp
6474+
type: vector
6475+
6476+
- algorithm: native:extractzvalues
6477+
name: Extract z, points
6478+
params:
6479+
COLUMN_PREFIX: z_
6480+
INPUT:
6481+
name: custom/pointszm.shp
6482+
type: vector
6483+
SUMMARIES:
6484+
- 0
6485+
- 1
6486+
- 2
6487+
- 3
6488+
- 4
6489+
- 5
6490+
- 6
6491+
- 7
6492+
- 8
6493+
- 9
6494+
- 10
6495+
- 11
6496+
- 12
6497+
- 13
6498+
- 14
6499+
- 15
6500+
results:
6501+
OUTPUT:
6502+
name: expected/extract_z_points.shp
6503+
type: vector
6504+
6505+
- algorithm: native:extractzvalues
6506+
name: Extract z, no z values
6507+
params:
6508+
COLUMN_PREFIX: z_
6509+
INPUT:
6510+
name: lines.gml|layername=lines
6511+
type: vector
6512+
SUMMARIES:
6513+
- 0
6514+
results:
6515+
OUTPUT:
6516+
name: expected/extract_z_none.shp
6517+
type: vector
6518+
6519+
- algorithm: native:extractmvalues
6520+
name: Extract m first only
6521+
params:
6522+
COLUMN_PREFIX: m_
6523+
INPUT:
6524+
name: lines_m.shp
6525+
type: vector
6526+
SUMMARIES:
6527+
- 0
6528+
results:
6529+
OUTPUT:
6530+
name: expected/extract_m_first.shp
6531+
type: vector
6532+
6533+
- algorithm: native:extractmvalues
6534+
name: Extract m, all stats
6535+
params:
6536+
COLUMN_PREFIX: ms_
6537+
INPUT:
6538+
name: lines_m.shp
6539+
type: vector
6540+
SUMMARIES:
6541+
- 0
6542+
- 1
6543+
- 2
6544+
- 3
6545+
- 4
6546+
- 5
6547+
- 6
6548+
- 7
6549+
- 8
6550+
- 9
6551+
- 10
6552+
- 11
6553+
- 12
6554+
- 13
6555+
- 14
6556+
- 15
6557+
results:
6558+
OUTPUT:
6559+
name: expected/extract_m_all.shp
6560+
type: vector
6561+
6562+
- algorithm: native:extractmvalues
6563+
name: Extract m, points
6564+
params:
6565+
COLUMN_PREFIX: mp_
6566+
INPUT:
6567+
name: custom/pointszm.shp
6568+
type: vector
6569+
SUMMARIES:
6570+
- 0
6571+
- 1
6572+
- 2
6573+
- 3
6574+
- 4
6575+
- 5
6576+
- 6
6577+
- 7
6578+
- 8
6579+
- 9
6580+
- 10
6581+
- 11
6582+
- 12
6583+
- 13
6584+
- 14
6585+
- 15
6586+
results:
6587+
OUTPUT:
6588+
name: expected/extract_m_points.shp
6589+
type: vector
6590+
6591+
- algorithm: native:extractmvalues
6592+
name: Extract m, no m values present
6593+
params:
6594+
COLUMN_PREFIX: m_
6595+
INPUT:
6596+
name: points.gml|layername=points
6597+
type: vector
6598+
SUMMARIES:
6599+
- 0
6600+
results:
6601+
OUTPUT:
6602+
name: expected/extract_m_none.shp
6603+
type: vector
6604+
64336605
- algorithm: native:splitlinesbylength
64346606
name: Split multilines by length
64356607
params:

src/analysis/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ SET(QGIS_ANALYSIS_SRCS
4646
processing/qgsalgorithmextractbyexpression.cpp
4747
processing/qgsalgorithmextractbyextent.cpp
4848
processing/qgsalgorithmextractbylocation.cpp
49+
processing/qgsalgorithmextractzmvalues.cpp
4950
processing/qgsalgorithmextractvertices.cpp
5051
processing/qgsalgorithmfiledownloader.cpp
5152
processing/qgsalgorithmfilter.cpp

0 commit comments

Comments
 (0)