Skip to content

feat(geotypes): rename domains and add geography variants#49

Merged
pyramation merged 1 commit intomainfrom
devin/1774221043-geotypes-rename-add-geography
Mar 22, 2026
Merged

feat(geotypes): rename domains and add geography variants#49
pyramation merged 1 commit intomainfrom
devin/1774221043-geotypes-rename-add-geography

Conversation

@pyramation
Copy link
Copy Markdown
Contributor

Summary

Renames the legacy PostGIS geometry domains and adds new geography (spherical/geodetic) domain variants:

Old New Type
geolocation geo_point geometry(Point, 4326)
geopolygon geo_polygon geometry(Polygon, 4326)
geography_point geography(Point, 4326)
geography_polygon geography(Polygon, 4326)

Geography domains use geodetic calculations on the sphere — ST_Distance returns meters, ST_DWithin uses meters, and results account for Earth's curvature. Geometry domains remain planar/flat.

Each domain has a full set of deploy/verify/revert migration files. Smart comment tags updated accordingly (e.g. pgpmInternalTypeGeoLocationpgpmInternalTypeGeoPoint).

Companion PR: constructive-io/constructive-db#669 (same changes for the in-repo copy of geotypes).

Review & Testing Checklist for Human

  • Breaking change: Confirm no downstream consumers depend on the old geolocation/geopolygon domain names or the old pgpmInternalTypeGeoLocation smart comment tag. This is a hard rename with no migration path.
  • Smart comment tags: Verify pgpmInternalTypeGeoPoint, pgpmInternalTypeGeoPolygon, pgpmInternalTypeGeographyPoint, pgpmInternalTypeGeographyPolygon are the correct tag names expected by the graphile-postgis plugin and any PostGraphile schema generation.
  • Bundled SQL (pgpm-geo-types--0.15.3.sql): Version number was not bumped — confirm this is intentional given the package.json is at 0.19.0. If the bundled SQL filename should reflect a new version, it needs updating.
  • Revert files use DROP TYPE (not DROP DOMAIN) — this matches the existing convention and works in PostgreSQL, but worth a glance.

Recommended test plan: Run cd packages/geotypes && pnpm test locally against a PostGIS-enabled Postgres instance to verify all 6 tests pass (3 geometry, 3 geography including the SF↔NYC distance check).

Notes

  • The constructive repo (graphile-postgis plugin) does not need changes — it detects geometry/geography types dynamically via PostGIS codec introspection, not by domain name.

Link to Devin session: https://app.devin.ai/sessions/2497d12c456844cc93429d027727addd
Requested by: @pyramation

- Rename geolocation -> geo_point (geometry)
- Rename geopolygon -> geo_polygon (geometry)
- Add geography_point (geography(Point, 4326))
- Add geography_polygon (geography(Polygon, 4326))
- Update pgpm.plan, bundled SQL, tests, and README
@devin-ai-integration
Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@pyramation pyramation merged commit a1dac72 into main Mar 22, 2026
22 checks passed
@pyramation pyramation deleted the devin/1774221043-geotypes-rename-add-geography branch March 22, 2026 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant