Skip to content

Commit 4aea715

Browse files
authored
fix(deps): upgrade plpygis (#359)
1 parent b030f83 commit 4aea715

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/pypgstac/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies = [
2222
"fire>=0.4.0",
2323
"hydraters>=0.1.0",
2424
"orjson>=3.7.0",
25-
"plpygis>=0.2.0",
25+
"plpygis>=0.5.0",
2626
"pydantic>=1.7",
2727
"python-dateutil>=2.8.0",
2828
"smart-open>=5.0",

src/pypgstac/src/pypgstac/load.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ def format_item(self, _item: Union[Path, str, Dict[str, Any]]) -> Dict[str, Any]
673673
geom = Geometry.from_geojson(geojson)
674674
if geom is None:
675675
raise Exception(f"Invalid geometry encountered: {geojson}")
676-
geometry = str(geom.wkb)
676+
geometry = str(geom.ewkb)
677677
out["geometry"] = geometry
678678

679679
content = dehydrate(base_item, item)

src/pypgstac/tests/test_load.py

+21
Original file line numberDiff line numberDiff line change
@@ -461,3 +461,24 @@ def test_load_items_nopartitionconstraint_succeeds(loader: Loader) -> None:
461461
""",
462462
)
463463
assert cdtmin == "2011-07-31 00:00:00+00"
464+
465+
466+
def test_valid_srid(loader: Loader) -> None:
467+
"""Test pypgstac items have a valid srid.
468+
469+
https://github.com/stac-utils/pgstac/issues/357
470+
"""
471+
loader.load_collections(
472+
str(TEST_COLLECTIONS_JSON),
473+
insert_mode=Methods.ignore,
474+
)
475+
loader.load_items(
476+
str(TEST_ITEMS),
477+
insert_mode=Methods.insert,
478+
)
479+
srid = loader.db.query_one(
480+
"""
481+
SELECT st_srid(geometry) from items LIMIT 1;
482+
""",
483+
)
484+
assert srid > 0

0 commit comments

Comments
 (0)