Skip to content

Commit

Permalink
Change postgis image in test_and_publish.yml to postgis/postgis:16-3.4
Browse files Browse the repository at this point in the history
Add some formatting for postgresql dialect, MULTIPOINT geom_type.
  • Loading branch information
sdp5 committed Apr 20, 2024
1 parent e584682 commit 2d81faa
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test_and_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

services:
postgres:
image: mdillon/postgis:11
image: postgis/postgis:16-3.4
env:
POSTGRES_DB: gis
POSTGRES_PASSWORD: gis
Expand Down
7 changes: 7 additions & 0 deletions tests/test_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,13 @@ class GeomTypeTable(base):
metadata.drop_all(bind=conn, checkfirst=True)
metadata.create_all(bind=conn)

if dialect_name == 'postgresql' and 'MULTIPOINT' in geom_type:
# formats wkt to wrap tuple elements in brackets,
# for example '(1 2, 3 4)' to '((1 2), (3 4))'.
wkt = "({})".format(
", ".join(map(lambda x: '({})'.format(x.strip()), wkt[1:-1].split(',')))
)

inserted_wkt = f"{geom_type}{wkt}"

# Use the DB to generate the corresponding raw WKB
Expand Down

0 comments on commit 2d81faa

Please sign in to comment.