[postgis-tickets] [PostGIS] #2996: ST_MinimumBoundingCircle doesn't always contain all points

PostGIS trac at osgeo.org
Mon Nov 17 20:22:39 PST 2014


#2996: ST_MinimumBoundingCircle doesn't always contain all points
--------------------------------------+-------------------------------------
 Reporter:  captainigloo              |       Owner:  pramsey      
     Type:  defect                    |      Status:  new          
 Priority:  medium                    |   Milestone:  PostGIS 2.1.5
Component:  postgis                   |     Version:  2.1.x        
 Keywords:  ST_MinimumBoundingCircle  |  
--------------------------------------+-------------------------------------
 For example when given the polygon:

 {{{
 POLYGON((26426 65078,26531 65242,26075 65136,26096 65427,26426 65078))
 }}}

 ST_MinimumBoundingCircle() returns a circle with centre POINT(26290 65280)
 and radius 243.56.  This is incorrect, one of the points (POINT(26075
 65136)) does not fall within this circle.  This can be demonstrated by
 selecting the radius of the MBC:

 {{{
 # select st_xmax(ST_MinimumBoundingCircle(st_geomfromtext('POLYGON((26426
 65078,26531 65242,26075 65136,26096 65427,26426 65078))'))) -
 st_x(st_centroid(ST_MinimumBoundingCircle(st_geomfromtext('POLYGON((26426
 65078,26531 65242,26075 65136,26096 65427,26426 65078))'))));
      ?column?
 ------------------
  243.560244342832
 (1 row)
 }}}

 Then selecting the distance from POINT(26075 65136) to the centre of the
 circle:

 {{{
 # select st_distance(st_geomfromtext('POINT(26075 65136)'),
 st_centroid(ST_MinimumBoundingCircle(st_geomfromtext('POLYGON((26426
 65078,26531 65242,26075 65136,26096 65427,26426 65078))'))));
    st_distance
 -----------------
  259.37884274511
 (1 row)
 }}}

 It looks like the function makes an incorrect assumption that the two
 points in the input geometry that are furthest away from each other fall
 on the minimum bounding circle, but this isn't always the case.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2996>
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