[postgis-tickets] [PostGIS] #3960: Unify centroid functions

PostGIS trac at osgeo.org
Wed Dec 27 13:28:20 PST 2017


#3960: Unify centroid functions
----------------------+---------------------------
  Reporter:  komzpa   |      Owner:  pramsey
      Type:  task     |     Status:  new
  Priority:  medium   |  Milestone:  PostGIS 2.5.0
 Component:  postgis  |    Version:  trunk
Resolution:           |   Keywords:
----------------------+---------------------------

Comment (by komzpa):

 Another centroid is in Geography.

 Weighted by M, accepts multipoint (hey @dbaston there is such
 practice...):
 https://github.com/postgis/postgis/blob/64134491b6fad59a11da05d494b6046b715e00df/postgis/geography_centroid.c#L179
 It looks like it doesn't accept Z and uses it only because of geog2cart
 transform.

 The whole geography centroid file fully reimplements logic of geos
 centroid, if I'm correctly looking at its code here:
 https://github.com/OSGeo/geos/blob/master/src/algorithm/Centroid.cpp



 Another small centroid in kmeans, 2D only, has logic of "check if it's
 current cluster" attached:
 https://github.com/postgis/postgis/blob/741b88eda71c80701366dffecd7fa665ee47060c/liblwgeom/lwkmeans.c#L45


 GBOX centroid, uses fancy point iteration likely hardwired to memory
 layout:
 https://github.com/postgis/postgis/blob/b72778f0ff5564a6ec5b5e45620fc0e3b90c8433/liblwgeom/lwgeodetic.c#L258

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3960#comment:2>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list