diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9295f5e..88be07b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: # Versioning: Commit messages & changelog - repo: https://github.com/commitizen-tools/commitizen - rev: v3.28.0 + rev: v3.29.1 hooks: - id: commitizen stages: [commit-msg] @@ -9,7 +9,7 @@ repos: # Lint / autoformat: Python code - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: "v0.5.6" + rev: "v0.6.8" hooks: # Run the linter - id: ruff @@ -19,7 +19,7 @@ repos: # Lint & Autoformat: SQL - repo: https://github.com/sqlfluff/sqlfluff - rev: 3.1.0 + rev: 3.2.0 hooks: - id: sqlfluff-lint files: ^fmtm_splitter/fmtm_algorithm.sql @@ -47,7 +47,7 @@ repos: ] # Lint: Markdown - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.41.0 + rev: v0.42.0 hooks: - id: markdownlint args: diff --git a/fmtm_splitter/fmtm_algorithm.sql b/fmtm_splitter/fmtm_algorithm.sql index d8760af..a2165e9 100644 --- a/fmtm_splitter/fmtm_algorithm.sql +++ b/fmtm_splitter/fmtm_algorithm.sql @@ -116,7 +116,7 @@ CREATE TABLE buildings AS ( SELECT b.*, polys.polyid - FROM "ways_poly" AS b, polygonsnocount AS polys + FROM ways_poly AS b, polygonsnocount AS polys WHERE ST_INTERSECTS(polys.geom, ST_CENTROID(b.geom)) AND b.tags ->> 'building' IS NOT NULL @@ -146,7 +146,7 @@ CREATE TABLE splitpolygons AS ( COUNT(b.geom) AS numfeatures, ST_AREA(sp.geog) AS area FROM polygonsnocount AS sp - LEFT JOIN "buildings" AS b + LEFT JOIN buildings AS b ON sp.polyid = b.polyid GROUP BY sp.polyid, sp.geom ) @@ -244,9 +244,10 @@ CREATE TABLE clusteredbuildings AS ( SELECT *, ST_CLUSTERKMEANS( - geom, CAST((b.numfeatures / %(num_buildings)s) + 1 AS integer) + b.geom, + CAST((b.numfeatures / %(num_buildings)s) + 1 AS integer) ) - OVER (PARTITION BY polyid) + OVER (PARTITION BY b.polyid) AS cid FROM buildingstocluster AS b ),