[postgis-users] Roeck test
Bruce Rindahl
rindahl at lrcwe.com
Mon Oct 27 08:25:13 PDT 2008
Hey Robert!
I have been thinking about this because I also have an application that
could use the minimum bounding circle. Unfortunately your idea would
not work. Picture the following counter example:
Start with a square. The centroid is in the center and you idea would
work fine. Now take a small segment of the top side and expand it like
a triangle upward. It will look like a little text box or cartoon
speech bubble. Now expand that little triangle a long distance away
from the square but keep it thin. The centroid of the shape will still
be dominated by the area of the square but your circle will go through
the far vertex. You can see the circle will be far greater than it needs
to be. If your shape is symmetrical, the minimum bounding circle will
run through the two bottom corners and the top expanded vertex.
I want to try to get a procedure done based on the previous links and
test it. If it works and there is a demand I could write a patch.
Bruce
Burgholzer,Robert wrote:
> Would the following work (if max_distance were available, which it is
> not in my distro)??:
>
> SELECT ST_Buffer(centroid(the_geom), max_distance(centroid(the_geom),
> the_geom) as bounding_circle ;
>
> This assumes the following:
> 1. The Roeck test is essentially the "bounding circle" of a geometry
> 2. The centroid is the center of mass
> 3. the furtherest point from the center of mass will be enclosed by a
> circle of radius equal to the distance from said point to the center
> 4. The max_distance function would work with points and multi-polygons
>
> Thinking about a "bounding circle" makes me wonder: is this a useful
> concept for geometric indexing? Could this be used in conjunction with
> the bounding box to create a more refined, quick and dirty bounding box
> containment index? In other words, if using the && operator essentially
> throws out (or includes if NOT'ed) points outside a bounding box, would
> it be computationally efficient to do something like a comparison to a
> circle on the objects centroid? In essence, all you would have to query
> would be the centroid, and radius of the spheres, like (in pseudo-code):
>
> If (distance(c1, c2) <= (r1 + r2)) then circles_overlap = true;
> # where r1 and r2 are the radii of the two bounding circles, and c1 and
> c2 are their centroids
>
> With this simple comparison (maybe not so simple computationally, I
> dunno), we could cut out a good deal of the blank space in the "corners"
> of the bounding box.
>
> Anyone?
>
>
> Robert W. Burgholzer
> Surface Water Modeler
> Office of Water Supply and Planning
> Virginia Department of Environmental Quality
> rwburgholzer at deq.virginia.gov
> 804-698-4405
> Open Source Modeling Tools:
> http://sourceforge.net/projects/npsource/
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Lee
> Meilleur
> Sent: Friday, October 24, 2008 4:20 PM
> To: 'PostGIS Users Discussion'
> Subject: RE: [postgis-users] Roeck test
>
>
> My bad, you're both correct. If that's the case, what does the
> ST_ExteriorRing function produce? When I test it I get "geom is not a
> polygon".
>
>
> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net
> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paul
> Ramsey
> Sent: Friday, October 24, 2008 2:59 PM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] Roeck test
>
>
> It's an inscribed circle? I thought it was a containing one.
>
> P.
>
> On Fri, Oct 24, 2008 at 12:50 PM, Lee Meilleur <lee.meilleur at gis.leg.mn>
> wrote:
>
>> The area of the convex hull is actually larger than the area of the
>> polygon, so the ratio ends up being greater than 1. With the Roeck
>> test, the ratio will always be between 0 and 1, with a compact polygon
>> approaching 1 (the area of the inner circle approaching the area of
>> the polygon). A ratio approaching 0 would indicate a gerrymandered
>> district.
>>
>> Assuming my statement is correct that is:
>>
>> SELECT congress.district, area(ST_ConvexHull(congress.the_geom)) /
>> area(congress.the_geom) AS convex_roeck FROM congress;
>>
>> Bruce, thanks for the idea, I'll see what I can produce from my
>> minimal experience with stored procedures.
>>
>>
>>
>> -----Original Message-----
>> From: postgis-users-bounces at postgis.refractions.net
>> [mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
>>
> Martin Davis
>
>> Sent: Friday, October 24, 2008 11:40 AM
>> To: PostGIS Users Discussion
>> Subject: Re: [postgis-users] Roeck test
>>
>>
>> Wouldn't it be easier and more accurate to use the convex hull of the
>> polygon instead of the minimum enclosing ball? The CH will have
>> smaller area (i.e. be a tighter bound on the area covered by the
>> polygon), so it seems like it would give a more accurate basis for
>> comparison.
>>
>> Lee Meilleur wrote:
>>
>>> Has anyone calculated the Roeck test using PostGIS? This is an area
>>> based measure that computes the ratio of the area of a polygon to the
>>> area of the minimum enclosing circle for the polygon. It's used to
>>> measure compactness of districts for redistricting applications,
>>> basically a way to test for gerrymandering. Thanks.
>>>
>>> Lee Meilleur
>>> LCC-GIS Office
>>> Minnesota Legislature
>>> 100 Rev. Dr. MLK Jr Blvd.
>>> 55 State Office Building
>>> St. Paul, MN 55155
>>> 651.296.0098 Fax: 651.297.3697
>>> lee.meilleur at gis.leg.mn
>>> http://www.gis.leg.mn
>>>
>>>
>>> _______________________________________________
>>> postgis-users mailing list postgis-users at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>>
>>>
>>>
>> --
>> Martin Davis
>> Senior Technical Architect
>> Refractions Research, Inc.
>> (250) 383-3022
>>
>> _______________________________________________
>> postgis-users mailing list postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
>>
> _______________________________________________
> postgis-users mailing list postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081027/3c666fdc/attachment.html>
More information about the postgis-users
mailing list