Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 9, 2024
1 parent c6ea3d0 commit 42b3f2e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ CREATE TABLE clusteredbuildings AS (
clusteredbuildingsnocombineduid AS (
SELECT
*,
ST_CLUSTERKMEANS(geom, ((b.numfeatures / 5) + 1)::integer)
OVER (PARTITION BY polyid)
ST_CLUSTERKMEANS(b.geom, ((b.numfeatures / 5) + 1)::integer)
OVER (PARTITION BY b.polyid)
AS cid
FROM buildingstocluster AS b
),
Expand Down
7 changes: 4 additions & 3 deletions fmtm_splitter/fmtm_algorithm.sql
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ CREATE TABLE lowfeaturecountpolygons AS (
SELECT *
FROM splitpolygons AS p
-- TODO: feature count should not be hard-coded
WHERE p.numfeatures < %(num_buildings)s
WHERE p.numfeatures < p.%(num_buildings)s
),

-- Find the neighbors of the low-feature-count polygons
Expand Down Expand Up @@ -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 / b.%(num_buildings)s) + 1 AS integer)
)
OVER (PARTITION BY polyid)
OVER (PARTITION BY b.polyid)
AS cid
FROM buildingstocluster AS b
),
Expand Down
2 changes: 1 addition & 1 deletion fmtm_splitter/splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import geojson
import numpy as np
from geojson import Feature, FeatureCollection, GeoJSON
from osm_rawdata.postgres import PostgresClient
from psycopg2.extensions import connection
from shapely.geometry import Polygon, shape
from shapely.geometry.geo import mapping
Expand All @@ -42,7 +43,6 @@
drop_tables,
insert_geom,
)
from osm_rawdata.postgres import PostgresClient

# Instantiate logger
log = logging.getLogger(__name__)
Expand Down

0 comments on commit 42b3f2e

Please sign in to comment.