[postgis-users] Combines polygons within a specified distanceto each other into new polygons.

Paragon Corporation lr at pcorp.us
Sat Sep 5 11:00:42 PDT 2009


Peter,
For the harder case where the reference is arbitrary and you are trying to
calculate many convex hulls.  This will be much slower -- depending on size
of your table. First thought that comes to mind is a self join.
The HAVING clause is to try to minimize on a geometry being collected in
more than one convex hull set.  Its not guaranteed though and also depending
on your pattern, it may miss some.

SELECT a.gid, ST_ConvexHull(ST_Collect(the_geom)) As convhull
FROM table_of_polygons As a INNER JOIN table_of_polygons As b ON
ST_DWithin(a.the_geom, b.the_geom, some_max_dist)
GROUP BY a.gid
HAVING a.gid = MIN(b.gid);

Hope that helps,
Regina

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Paragon
Corporation
Sent: Saturday, September 05, 2009 11:07 AM
To: 'PostGIS Users Discussion'
Subject: Re: [postgis-users] Combines polygons within a specified distanceto
each other into new polygons.

Peter,
You would use a combination of ST_DWithin, ST_Collect, and ST_ConvexHull.
When you say within a max distance -- you mean of a reference geometry or
from each other?  From each other can be kind of expensive.

So something of the form

SELECT ST_ConvexHull(ST_Collect(the_geom))
FROM table_of_polygons
WHERE ST_DWithin(ST_GeomFromText(.....), the_geom, max_dist)

http://postgis.refractions.net/documentation/manual-svn/ST_ConvexHull.html

http://postgis.refractions.net/documentation/manual-svn/ST_Collect.html

http://postgis.refractions.net/documentation/manual-svn/ST_GeomFromText.html

http://postgis.refractions.net/documentation/manual-svn/ST_DWithin.html

Leo



-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of Peter
Freimuth
Sent: Saturday, September 05, 2009 9:26 AM
To: PostGIS Users Discussion
Subject: [postgis-users] Combines polygons within a specified distance to
each other into new polygons.

Hi PostGIS User,
i am searching for a postgis based solution to create a convexhull on groups
of polygons which are grouped via a max distance value.



Any idea or a solution is welcome!

Kind regards,
Peter



-- 
Peter Freimuth  Muskauer Str. 11   10997 Berlin
Location:http://www.berlinonline.de/citymap/map.asp?start.x=5&plz=10997&str=
Muskauer+Str.+11&grid=dedatlas10
============================================================================
============================
Tel:+49(0)30-69816610  Mobil:+49(0)175-8434074  Firma:+49(0)3381-8904327
============================================================================
============================
mailto:pfreimuth at arcor.de
skype:pfreimuth
msn:peter_freimuth at hotmail.com

_______________________________________________
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





More information about the postgis-users mailing list