Skip to content

Commit

Permalink
Merge branch 'release/v0.7.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
jlhumber committed Jun 27, 2024
2 parents ae1a34d + 3957c88 commit 66091f1
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 33 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ Support provided for the following constraint types:

## Release History

### v0.7.2
* bump `user_version` to reflect adopted version 1.4.0 of OGC GeoPackage
* updated r-tree triggers based on changes made in 1.4.0

### v0.7.1
* ensure support for Python 3.12 and update documentation / configuration

Expand Down
2 changes: 1 addition & 1 deletion fudgeo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"""


__version__ = '0.7.1'
__version__ = '0.7.2'


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion fudgeo/geopkg.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PRAGMA application_id=0x47504B47;
PRAGMA user_version=10301;
PRAGMA user_version=10400;

-- TABLES

Expand Down
43 changes: 29 additions & 14 deletions fudgeo/sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,20 +303,6 @@
);
END;
/* Conditions: Update of geometry column to non-empty geometry
No row ID change
Actions : Update record in rtree */
CREATE TRIGGER "rtree_{0}_{1}_update1" AFTER UPDATE OF "{1}" ON "{0}"
WHEN OLD."{2}" = NEW."{2}" AND
(NEW."{1}" NOTNULL AND NOT ST_IsEmpty(NEW."{1}"))
BEGIN
INSERT OR REPLACE INTO "rtree_{0}_{1}" VALUES (
NEW."{2}",
ST_MinX(NEW."{1}"), ST_MaxX(NEW."{1}"),
ST_MinY(NEW."{1}"), ST_MaxY(NEW."{1}")
);
END;
/* Conditions: Update of geometry column to empty geometry
No row ID change
Actions : Remove record from rtree */
Expand Down Expand Up @@ -355,6 +341,35 @@
DELETE FROM "rtree_{0}_{1}" WHERE id IN (OLD."{2}", NEW."{2}");
END;
/* Conditions: Update a non-empty geometry with another non-empty geometry
Actions : Replace record from R-tree for identifier */
CREATE TRIGGER "rtree_{0}_{1}_update6" AFTER UPDATE OF "{1}" ON "{0}"
WHEN OLD."{2}" = NEW."{2}" AND
(NEW."{1}" NOTNULL AND NOT ST_IsEmpty(NEW."{1}")) AND
(OLD."{1}" NOTNULL AND NOT ST_IsEmpty(OLD."{1}"))
BEGIN
UPDATE "rtree_{0}_{1}" SET
minx = ST_MinX(NEW."{1}"),
maxx = ST_MaxX(NEW."{1}"),
miny = ST_MinY(NEW."{1}"),
maxy = ST_MaxY(NEW."{1}")
WHERE id = NEW."{2}";
END;
/* Conditions: Update a null/empty geometry with a non-empty geometry
Actions : Insert record into R-tree for new identifier */
CREATE TRIGGER "rtree_{0}_{1}_update7" AFTER UPDATE OF "{1}" ON "{0}"
WHEN OLD."{2}" = NEW."{2}" AND
(NEW."{1}" NOTNULL AND NOT ST_IsEmpty(NEW."{1}")) AND
(OLD."{1}" ISNULL OR ST_IsEmpty(OLD."{1}"))
BEGIN
INSERT INTO "rtree_{0}_{1}" VALUES (
NEW."{2}",
ST_MinX(NEW."{1}"), ST_MaxX(NEW."{1}"),
ST_MinY(NEW."{1}"), ST_MaxY(NEW."{1}")
);
END;
/* Conditions: Row deleted
Actions : Remove record from rtree for old identifier */
CREATE TRIGGER "rtree_{0}_{1}_delete" AFTER DELETE ON "{0}"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "fudgeo"
version = "0.7.1"
version = "0.7.2"
description = """\
GeoPackage support from Python. fudgeo is a lightweight package \
for creating OGC GeoPackages, Feature Classes, and Tables. Easily \
Expand Down
32 changes: 16 additions & 16 deletions tests/test_geopkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ def test_create_table_drop_table(tmp_path, fields, name, ogr_contents, has_table
('SEL;ECT', False, 0, False),
('SEL ECT', True, 4, False),
('SEL ECT', False, 0, False),
('ASDF', True, 10, True),
('ASDF', False, 6, True),
('SELECT', True, 10, True),
('SELECT', False, 6, True),
('SEL;ECT', True, 10, True),
('SEL;ECT', False, 6, True),
('SEL ECT', True, 10, True),
('SEL ECT', False, 6, True),
('ASDF', True, 11, True),
('ASDF', False, 7, True),
('SELECT', True, 11, True),
('SELECT', False, 7, True),
('SEL;ECT', True, 11, True),
('SEL;ECT', False, 7, True),
('SEL ECT', True, 11, True),
('SEL ECT', False, 7, True),
])
def test_create_feature_class(tmp_path, fields, name, ogr_contents, trigger_count, add_index):
"""
Expand Down Expand Up @@ -232,14 +232,14 @@ def test_create_feature_class(tmp_path, fields, name, ogr_contents, trigger_coun
('SEL;ECT', False, False, 0, False),
('SEL ECT', True, True, 2, False),
('SEL ECT', False, False, 0, False),
('ASDF', True, True, 8, True),
('ASDF', False, False, 6, True),
('SELECT', True, True, 8, True),
('SELECT', False, False, 6, True),
('SEL;ECT', True, True, 8, True),
('SEL;ECT', False, False, 6, True),
('SEL ECT', True, True, 8, True),
('SEL ECT', False, False, 6, True),
('ASDF', True, True, 9, True),
('ASDF', False, False, 7, True),
('SELECT', True, True, 9, True),
('SELECT', False, False, 7, True),
('SEL;ECT', True, True, 9, True),
('SEL;ECT', False, False, 7, True),
('SEL ECT', True, True, 9, True),
('SEL ECT', False, False, 7, True),
])
def test_create_feature_drop_feature(tmp_path, fields, name, ogr_contents, has_table, trigger_count, add_index):
"""
Expand Down

0 comments on commit 66091f1

Please sign in to comment.