From 38846d811224e0d3fbdd80d8922ef57db9204a4d Mon Sep 17 00:00:00 2001 From: Chris Behrens Date: Sat, 16 Mar 2024 02:35:30 -0700 Subject: [PATCH] Bump version to 0.99.8 * Fix overlap query again? (comstud) --- db_store/sql/4_overlap_fix.up.sql | 19 +++++++++++++++++++ version/version.go | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 db_store/sql/4_overlap_fix.up.sql diff --git a/db_store/sql/4_overlap_fix.up.sql b/db_store/sql/4_overlap_fix.up.sql new file mode 100644 index 0000000..9048ccf --- /dev/null +++ b/db_store/sql/4_overlap_fix.up.sql @@ -0,0 +1,19 @@ +-- Fix procedure for overlap disablement +-- I guess ST_Overlaps() is false if fully contained? +-- So, just check we have Poly/MPoly before doing ST_Area(). +DROP PROCEDURE IF EXISTS fl_nest_filter_overlap; +CREATE PROCEDURE fl_nest_filter_overlap (IN maximum_overlap double) +BEGIN + DROP TEMPORARY TABLE IF EXISTS overlapNest; + CREATE TEMPORARY TABLE overlapNest AS ( + SELECT b.nest_id + FROM nests a, nests b + WHERE a.active = 1 AND b.active = 1 AND + a.m2 > b.m2 AND + ST_Intersects(a.polygon, b.polygon) AND + ST_GeometryType(ST_Intersection(a.polygon, b.polygon)) IN ('Polygon', 'MultiPolygon') AND + (100 * ST_Area(ST_Intersection(a.polygon,b.polygon)) / ST_Area(b.polygon)) > maximum_overlap + ); + UPDATE nests a, overlapNest b SET a.active=0, discarded = 'overlap' WHERE a.nest_id=b.nest_id; + DROP TEMPORARY TABLE overlapNest; +END diff --git a/version/version.go b/version/version.go index ef5ef02..dcf0e07 100644 --- a/version/version.go +++ b/version/version.go @@ -1,5 +1,5 @@ package version const ( - APP_VERSION = "0.99.7" + APP_VERSION = "0.99.8" )