The PostGIS documentation states that ST_PointOnSurface
returns "a POINT guaranteed to lie on the surface". It seems like this function could be trivially implemented to give results that satisfy the documentation but provide little real-world utility, though I'm certain that PostGIS provides a non-trivial implementation.
This introduction to PostGIS provides a nice comparison and contrast of ST_Centroid
with ST_PointOnSurface
and says that "[ST_PointOnSurface] is substantially more computationally expensive than the centroid operation".
Is there a more thorough explanation of how ST_PointOnSurface
is calculated? I've been using ST_Centroid
, but have encountered some edge cases in my data where the centroid is outside the geometry. I believe that ST_PointOnSurface
is the correct substitute, but the function name and documentation leave room for uncertainty.
Further, is the computational expense of ST_PointOnSurface
incurred even if the centroid does lie within the geometry already?