[postgis-tickets] [PostGIS] #2841: ST_MinimumBoundingCircle and ST_ConcaveHull not covering original

PostGIS trac at osgeo.org
Wed Sep 7 05:25:53 PDT 2016


#2841: ST_MinimumBoundingCircle and ST_ConcaveHull not covering original
----------------------+---------------------------
  Reporter:  robe     |      Owner:  robe
      Type:  defect   |     Status:  reopened
  Priority:  medium   |  Milestone:  PostGIS 2.2.3
 Component:  postgis  |    Version:  trunk
Resolution:           |   Keywords:
----------------------+---------------------------

Comment (by dbaston):

 That's a good point - there's no reason we need to construct the circle
 approximation using ST_Buffer.  What do you think about the following?

 {{{

 CREATE OR REPLACE FUNCTION pg_temp.mbc_test (center geometry, radius
 float, segments int)
 RETURNS geometry AS $$
 DECLARE
 points geometry[];
 theta float;
 r float;
 i int;
 BEGIN
     theta := 2 * pi() / segments;
     r := radius * sqrt(1 + tan(theta)^2); -- use excircle instead of
 incircle
     FOR i IN SELECT generate_series(0, segments) LOOP
         points[i] := ST_Translate(center, r*sin(i*theta), r*cos(i*theta));
     END LOOP;
     RETURN ST_MakeLine(points);
 END;
 $$ LANGUAGE PLPGSQL;

 SELECT pg_temp.mbc_test((c).center, (c).radius, 128) FROM
       (SELECT geom, ST_MinimumBoundingRadius(geom) AS c FROM foo) sq;
 }}}

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/2841#comment:10>
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