[postgis-users] The max width of a polygon

Nicolas Ribot nicolas.ribot at gmail.com
Sat Sep 8 10:06:10 PDT 2012


Hi,

If your polygons are mainly concave, you could use distance and maxDistance
on the point-set composing polygon vertices:

with pg_points as (
select st_dumppoints(st_exteriorRing(
     'POLYGON (( 120 300, 180 340, 180 300, 200 300, 157.5 292.5, 186
250.5, 129.5 222, 100 240, 115.5 256, 140 280, 140 300, 120 300
))'::geometry)
) as dump
) select min(st_distance((p1.dump).geom, (p2.dump).geom)),
         max(st_maxDistance((p1.dump).geom, (p2.dump).geom))

from pg_points p1, pg_points p2

where (p1.dump).path[1] <> (p2.dump).path[1]
-- start/end points skipped, to avoid 0 distance
and (p1.dump).path[1] <> array_length((p2.dump).path, 1)
and (p2.dump).path[1] <> array_length((p1.dump).path, 1);

It will fail on polygons with spikes
examples attached

Nicolas

On 8 September 2012 17:42, Andrea Peri <aperi2007 at gmail.com> wrote:
> Hi,
>
> For some polygons of kind simple (not multipart) is possible to calculate
> the min and max width of that polygons ?
>
> Thx,
>
> --
> -----------------
> Andrea Peri
> . . . . . . . . .
> qwerty àèìòù
> -----------------
>
>
> _______________________________________________
> 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/20120908/dbb139fa/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2012-09-08 at 7.05.23 PM.png
Type: image/png
Size: 29559 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120908/dbb139fa/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2012-09-08 at 7.05.29 PM.png
Type: image/png
Size: 52155 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20120908/dbb139fa/attachment-0001.png>


More information about the postgis-users mailing list