Skip to content

Add GeoJSON and Well-Known Text formats for complex location geometries#63

Draft
schuyler wants to merge 2 commits intolexicon-community:mainfrom
schuyler:geometries
Draft

Add GeoJSON and Well-Known Text formats for complex location geometries#63
schuyler wants to merge 2 commits intolexicon-community:mainfrom
schuyler:geometries

Conversation

@schuyler
Copy link
Contributor

The current set of location schemas only support either point geometries, or grid cells using the H3 system.

This PR hopes to open up the ATGeo lexicon to representing all forms of spatial geometry, including lines, polygons, and geometry collections.

The two most-widely readable formats for flexible geospatial representation are GeoJSON and Well-Known Text, or WKT.

The proposed format for community.lexicon.geo.geojson.geometry is bytes, and not object, because GeoJSON data typically contains raw floating point values. The GeoJSON object could be represented as a string in Lexicon, but it might get confusing to developers or tools to have JSON embedded within JSON. That leaves bytes encoding as the obvious alternative, but maybe JSON-in-JSON isn't as bad as it seems?

The proposed format for community.lexicon.geo.wkt.geometry is just string, because WKT strings are meant, at some level, to be human readable.

The advantage of providing potential support for these two formats is that, as standard GIS interchange formats, we are leveraging prior art in representing multidimensional geometries and creating opportunity for interoperability with GIS software.

Finally, this PR includes a proposal for a bounding box geometry, which might be useful in the future for indicating rough geographic extents, or as part of a query schema. I have proposed north, south, east, west members in preference to xmin, ymin, xmax, ymax because longitude is always x and latitude always y. The inversion from conventional "lat/long" is a constant source of confusion to new geospatial developers and should be avoided.

All three proposed schemas include an optional name field for congruence with existing community.lexicon.location schemas.

@schuyler
Copy link
Contributor Author

I haven't provided documentation in this PR, as I'm still waiting for the docs I proposed in #62 to be accepted, but once that PR is incorporated, I can add documentation for these schemas as well.

@schuyler schuyler force-pushed the geometries branch 2 times, most recently from 268288e to e775b69 Compare July 19, 2025 19:18
@schuyler schuyler force-pushed the geometries branch 2 times, most recently from 11022a0 to dfebbd4 Compare July 19, 2025 19:28
@schuyler schuyler marked this pull request as draft July 22, 2025 23:13
@schuyler
Copy link
Contributor Author

Converting this to draft while contemplating whether complex geometries should be represented as blobs rather than embedded directly into a location object.

@bmann
Copy link

bmann commented Aug 10, 2025

I think this would be good for a companion Discourse thread. Also good that I can point the ActivityPub people at the thread.

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.

2 participants