[GRASS-git] [OSGeo/grass] 9d4460: v.dissolve: Compute attribute aggregate statistics...

Vaclav Petras noreply at github.com
Fri Jul 21 18:53:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 9d446039d85db8cd11387b0a47a2da39b0d6e1b4
      https://github.com/OSGeo/grass/commit/9d446039d85db8cd11387b0a47a2da39b0d6e1b4
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2023-07-21 (Fri, 21 Jul 2023)

  Changed paths:
    A scripts/v.dissolve/tests/conftest.py
    A scripts/v.dissolve/tests/v_dissolve_aggregate_test.py
    A scripts/v.dissolve/tests/v_dissolve_geometry_test.py
    A scripts/v.dissolve/tests/v_dissolve_layers_test.py
    A scripts/v.dissolve/tests/v_dissolve_test.py
    M scripts/v.dissolve/v.dissolve.html
    M scripts/v.dissolve/v.dissolve.py
    A scripts/v.dissolve/v_dissolve.ipynb
    A scripts/v.dissolve/v_dissolve_towns.png
    A scripts/v.dissolve/v_dissolve_zipcodes.png

  Log Message:
  -----------
  v.dissolve: Compute attribute aggregate statistics (#2388)

In addition to geometry dissolving, compute aggregate statistics for the attribute values of dissolved features with v.db.univar and SQL.

v.db.select with group is used to obtain unique values of the column the dissolving is based on. Add column and update now happens for every value, column, and statistics.

Originally implemented with v.db.univar only because it has a good set of functions, but direct SQL is faster and potentially can have more functions (although default SQLite has less).

Auto-generates names and combinations of column-method for convenience, but when all needed parameters are provided, uses them as is.

Has documentation, examples, image for original functionality, and test (image generated in notebook).

Uses plural for columns and methods.

Removes duplicate columns and methods for non-explicit automatic (interactive) result column handling.

Support SQL expressions as columns (as in v.db.update query_column or v.db.select columns). Supports general SQL syntax just like v.db.select for the price of less checks. Supports also text-returning aggregate functions and functions with multiple parameters such as SQLite group_concat. Supports any layer, not just 1, for attributes.

Uses a simple SQL escape function to double single quotes.

Requires v.db.univar JSON output and v.db.select column info in JSON output.

Handles cleanup from the main function. Removes global variables. Uses PID and node name for the temporary vector. Partially modernizes the existing code by using gs alias instead of grass alias. Improves author lists.




More information about the grass-commit mailing list