Skip to content
Permalink
Browse files

[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).
  • Loading branch information
nyalldawson committed Jan 3, 2019
1 parent e99072b commit cef9c4eaec4ccf33bda7bc6d0cff5a6b8d66e488
Showing with 545 additions and 0 deletions.
  1. BIN python/plugins/processing/tests/testdata/expected/extract_m_all.dbf
  2. +1 −0 python/plugins/processing/tests/testdata/expected/extract_m_all.prj
  3. +1 −0 python/plugins/processing/tests/testdata/expected/extract_m_all.qpj
  4. BIN python/plugins/processing/tests/testdata/expected/extract_m_all.shp
  5. BIN python/plugins/processing/tests/testdata/expected/extract_m_all.shx
  6. BIN python/plugins/processing/tests/testdata/expected/extract_m_first.dbf
  7. +1 −0 python/plugins/processing/tests/testdata/expected/extract_m_first.prj
  8. +1 −0 python/plugins/processing/tests/testdata/expected/extract_m_first.qpj
  9. BIN python/plugins/processing/tests/testdata/expected/extract_m_first.shp
  10. BIN python/plugins/processing/tests/testdata/expected/extract_m_first.shx
  11. BIN python/plugins/processing/tests/testdata/expected/extract_m_none.dbf
  12. +1 −0 python/plugins/processing/tests/testdata/expected/extract_m_none.prj
  13. +1 −0 python/plugins/processing/tests/testdata/expected/extract_m_none.qpj
  14. BIN python/plugins/processing/tests/testdata/expected/extract_m_none.shp
  15. BIN python/plugins/processing/tests/testdata/expected/extract_m_none.shx
  16. BIN python/plugins/processing/tests/testdata/expected/extract_m_points.dbf
  17. +1 −0 python/plugins/processing/tests/testdata/expected/extract_m_points.prj
  18. +1 −0 python/plugins/processing/tests/testdata/expected/extract_m_points.qpj
  19. BIN python/plugins/processing/tests/testdata/expected/extract_m_points.shp
  20. BIN python/plugins/processing/tests/testdata/expected/extract_m_points.shx
  21. BIN python/plugins/processing/tests/testdata/expected/extract_z_all.dbf
  22. +1 −0 python/plugins/processing/tests/testdata/expected/extract_z_all.prj
  23. +1 −0 python/plugins/processing/tests/testdata/expected/extract_z_all.qpj
  24. BIN python/plugins/processing/tests/testdata/expected/extract_z_all.shp
  25. BIN python/plugins/processing/tests/testdata/expected/extract_z_all.shx
  26. BIN python/plugins/processing/tests/testdata/expected/extract_z_first.dbf
  27. +1 −0 python/plugins/processing/tests/testdata/expected/extract_z_first.prj
  28. +1 −0 python/plugins/processing/tests/testdata/expected/extract_z_first.qpj
  29. BIN python/plugins/processing/tests/testdata/expected/extract_z_first.shp
  30. BIN python/plugins/processing/tests/testdata/expected/extract_z_first.shx
  31. BIN python/plugins/processing/tests/testdata/expected/extract_z_none.dbf
  32. +1 −0 python/plugins/processing/tests/testdata/expected/extract_z_none.prj
  33. +1 −0 python/plugins/processing/tests/testdata/expected/extract_z_none.qpj
  34. BIN python/plugins/processing/tests/testdata/expected/extract_z_none.shp
  35. BIN python/plugins/processing/tests/testdata/expected/extract_z_none.shx
  36. BIN python/plugins/processing/tests/testdata/expected/extract_z_points.dbf
  37. +1 −0 python/plugins/processing/tests/testdata/expected/extract_z_points.prj
  38. +1 −0 python/plugins/processing/tests/testdata/expected/extract_z_points.qpj
  39. BIN python/plugins/processing/tests/testdata/expected/extract_z_points.shp
  40. BIN python/plugins/processing/tests/testdata/expected/extract_z_points.shx
  41. +172 −0 python/plugins/processing/tests/testdata/qgis_algorithm_tests.yaml
  42. +1 −0 src/analysis/CMakeLists.txt
  43. +245 −0 src/analysis/processing/qgsalgorithmextractzmvalues.cpp
  44. +108 −0 src/analysis/processing/qgsalgorithmextractzmvalues.h
  45. +3 −0 src/analysis/processing/qgsnativealgorithms.cpp
Binary file not shown.
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
@@ -0,0 +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.
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
@@ -0,0 +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.
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
@@ -0,0 +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.
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
@@ -0,0 +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.
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
@@ -0,0 +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.
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
@@ -0,0 +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.
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
@@ -0,0 +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.
@@ -0,0 +1 @@
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
@@ -0,0 +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.
@@ -6430,6 +6430,178 @@ tests:
name: expected/force_rhr_multipolys.gml
type: vector

- algorithm: native:extractzvalues
name: Extract z, first value only
params:
COLUMN_PREFIX: z_
INPUT:
name: lines_z.shp
type: vector
SUMMARIES:
- 0
results:
OUTPUT:
name: expected/extract_z_first.shp
type: vector

- algorithm: native:extractzvalues
name: Extract z, all stats
params:
COLUMN_PREFIX: zs_
INPUT:
name: lines_z.shp
type: vector
SUMMARIES:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
results:
OUTPUT:
name: expected/extract_z_all.shp
type: vector

- algorithm: native:extractzvalues
name: Extract z, points
params:
COLUMN_PREFIX: z_
INPUT:
name: custom/pointszm.shp
type: vector
SUMMARIES:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
results:
OUTPUT:
name: expected/extract_z_points.shp
type: vector

- algorithm: native:extractzvalues
name: Extract z, no z values
params:
COLUMN_PREFIX: z_
INPUT:
name: lines.gml|layername=lines
type: vector
SUMMARIES:
- 0
results:
OUTPUT:
name: expected/extract_z_none.shp
type: vector

- algorithm: native:extractmvalues
name: Extract m first only
params:
COLUMN_PREFIX: m_
INPUT:
name: lines_m.shp
type: vector
SUMMARIES:
- 0
results:
OUTPUT:
name: expected/extract_m_first.shp
type: vector

- algorithm: native:extractmvalues
name: Extract m, all stats
params:
COLUMN_PREFIX: ms_
INPUT:
name: lines_m.shp
type: vector
SUMMARIES:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
results:
OUTPUT:
name: expected/extract_m_all.shp
type: vector

- algorithm: native:extractmvalues
name: Extract m, points
params:
COLUMN_PREFIX: mp_
INPUT:
name: custom/pointszm.shp
type: vector
SUMMARIES:
- 0
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
results:
OUTPUT:
name: expected/extract_m_points.shp
type: vector

- algorithm: native:extractmvalues
name: Extract m, no m values present
params:
COLUMN_PREFIX: m_
INPUT:
name: points.gml|layername=points
type: vector
SUMMARIES:
- 0
results:
OUTPUT:
name: expected/extract_m_none.shp
type: vector

- algorithm: native:splitlinesbylength
name: Split multilines by length
params:
@@ -46,6 +46,7 @@ SET(QGIS_ANALYSIS_SRCS
processing/qgsalgorithmextractbyexpression.cpp
processing/qgsalgorithmextractbyextent.cpp
processing/qgsalgorithmextractbylocation.cpp
processing/qgsalgorithmextractzmvalues.cpp
processing/qgsalgorithmextractvertices.cpp
processing/qgsalgorithmfiledownloader.cpp
processing/qgsalgorithmfilter.cpp

0 comments on commit cef9c4e

Please sign in to comment.
You can’t perform that action at this time.