From 77c616b67b9521c3ca44182d3613469759caa708 Mon Sep 17 00:00:00 2001 From: Bee Webb Date: Sun, 19 Apr 2026 13:42:29 +0000 Subject: [PATCH 1/3] geo: Catch another type of exception from shapely --- CHANGELOG.md | 4 ++++ flattentool/json_input.py | 7 ++++++- flattentool/tests/test_json_input.py | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 75845fe..afe8d6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Fixed + +- Catch another type of geographic exception from shapely https://github.com/OpenDataServices/flatten-tool/pull/484 + ### Removed - We no longer support Python 3.9 - security support has ended diff --git a/flattentool/json_input.py b/flattentool/json_input.py index 2a00772..414d003 100644 --- a/flattentool/json_input.py +++ b/flattentool/json_input.py @@ -396,7 +396,12 @@ def parse_json_dict( _sheet_key = sheet_key(sheet, parent_name.strip("/")) try: geom = shapely.geometry.shape(json_dict) - except (shapely.errors.GeometryTypeError, TypeError, ValueError) as e: + except ( + shapely.errors.GeometryTypeError, + shapely.errors.GEOSException, + TypeError, + ValueError, + ) as e: warn( _("Invalid GeoJSON: {parser_msg}").format(parser_msg=repr(e)), DataErrorWarning, diff --git a/flattentool/tests/test_json_input.py b/flattentool/tests/test_json_input.py index a2f3c20..4228eb5 100644 --- a/flattentool/tests/test_json_input.py +++ b/flattentool/tests/test_json_input.py @@ -961,6 +961,14 @@ def test_parse_bad_geojson(recwarn): ], } }, + { + "d": { + "type": "LineString", + "coordinates": [ + [Decimal("-0.173"), Decimal("5.626")], + ], + } + }, ], } ], @@ -976,6 +984,7 @@ def test_parse_bad_geojson(recwarn): {}, {}, {}, + {}, ] w = recwarn.pop(UserWarning) assert ( @@ -993,6 +1002,11 @@ def test_parse_bad_geojson(recwarn): str(w.message) == "Invalid GeoJSON: ValueError('setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (3,) + inhomogeneous part.')" ) + w = recwarn.pop(UserWarning) + assert ( + str(w.message) + == "Invalid GeoJSON: GEOSException('IllegalArgumentException: point array must contain 0 or >1 elements\\n')" + ) assert len(recwarn.list) == 0 From acd14df6c14743a96660b50aaf6ece08a3c359c9 Mon Sep 17 00:00:00 2001 From: Bee Webb Date: Sun, 19 Apr 2026 13:17:46 +0000 Subject: [PATCH 2/3] setup.cfg: Use underscores instead of deprecated/broken dashes --- setup.cfg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index ceef7eb..332e0cb 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,10 +4,10 @@ ignore = E,W [extract_messages] mapping_file = babel.cfg -output-file = flattentool/locale/en/LC_MESSAGES/flatten-tool.po +output_file = flattentool/locale/en/LC_MESSAGES/flatten-tool.po [compile_catalog] directory = flattentool/locale domain = flatten-tool -use-fuzzy = yes +use_fuzzy = yes From 5318c9279339546c736fb3b3bccbce96bf52768b Mon Sep 17 00:00:00 2001 From: Bee Webb Date: Sun, 19 Apr 2026 13:43:41 +0000 Subject: [PATCH 3/3] release: 0.28.0 --- CHANGELOG.md | 2 ++ setup.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index afe8d6d..3f2b5ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +## [0.28.0] - 2026-04-19 + ### Fixed - Catch another type of geographic exception from shapely https://github.com/OpenDataServices/flatten-tool/pull/484 diff --git a/setup.py b/setup.py index 896aa53..9ea8380 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,7 @@ def run(self): setup( name="flattentool", - version="0.27.0", + version="0.28.0", author="Open Data Services", author_email="code@opendataservices.coop", packages=["flattentool"],