Skip to content

GH-4233: Add GeoSPARQL 1.1 centroid function - #4234

Merged
afs merged 1 commit into
apache:mainfrom
edmondchuc:feat/geosparql/centroid-function
Sep 26, 2026
Merged

afs merged 1 commit into
apache:mainfrom
edmondchuc:feat/geosparql/centroid-function

Conversation

@edmondchuc

@edmondchuc edmondchuc commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

GitHub issue resolved #4233

Adds the GeoSPARQL 1.1 geof:centroid function, also available through GeometryWrapper.centroid().

The function computes a planar centroid using JTS and returns a Point in the input's literal format and SRS. The calculation ignores Z and M and geographic coordinates are treated as planar coordinates without reprojection.

For a non-empty input in a three-dimensional CRS, the result has Z=0. This includes 3D GML results, which remain valid in the source CRS. Tests cover GML serialisation and parsing, WKT, and SPARQL function composition.


  • Tests are included.
  • Documentation change and updates are provided for the Apache Jena website
  • Commits have been squashed to remove intermediate development commit messages.
  • Key commit messages start with the issue number (GH-xxxx)

By submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.


See the Apache Jena "Contributing" guide.

@afs afs added the GeoSPARQL label Sep 26, 2026
@edmondchuc
edmondchuc force-pushed the feat/geosparql/centroid-function branch from ca07a41 to e67d816 Compare September 26, 2026 15:26
@edmondchuc
edmondchuc force-pushed the feat/geosparql/centroid-function branch from e67d816 to 08a89d4 Compare September 26, 2026 15:50
@afs
afs merged commit e1e21b8 into apache:main Sep 26, 2026
1 check passed
@edmondchuc
edmondchuc deleted the feat/geosparql/centroid-function branch September 27, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add GeoSPARQL 1.1 geof:centroid function

2 participants