"Centroid ( ): Point — The mathematical centroid for this Surface as a
Point. The result is not guaranteed to
be on this Surface."
What ST_Centroid returns is the real centroid according to this
definition, the centre of gravity of the feature. Bounding box has
nothing to do with that. What you would like to call as "real centroid"
is closer to another method that is defined in the standard:
PointOnSurface ( ): Point — A Point guaranteed to be on this Surface.
However, PointOnSurface can be in any place on the surface.
-Jukka Rahkonen-
Kyle Felipe Vieira Roberto kirjoitti 2018-01-15 19:22:
> Hi guys.....
>
> I'm realy living use spatialite here, and i have a question,
>
> The function Centroid(geometry) return the center from bounding box of
> geometry or retur"ns the real centroid.
>
> [1]
>
> If is the bounding box, there is a way to get the real centroid?
>
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to spatiali...@googlegroups.com
On Mon, 15 Jan 2018 09:22:22 -0800 (PST), Kyle Felipe Vieira Roberto
wrote:
> Hi guys.....
>
> I'm realy living use spatialite here, and i have a question,
>
> The function Centroid(geometry) return the center from bounding box
> of
> geometry or returns the real centroid.
>
Hi Kyle,
it obviously returns the real centroid.
note: depending on the specific shape of your geometry the centroid
can eventually fall outside the geometry itself, as you can see in
the attached figure.
SELECT ST_Union( g.geom, ST_Centroid( g.geom ))
FROM (SELECT ST_GeomFromText('POLYGON((0 0, 2 0, 2 8, 5 8, 5 6, 10 6,
10 10, 0 10, 0 0))') AS geom) AS g;