[postgis-users] bounday or convex hull of a bunch of points

Paragon lr at pcorp.us
Sat Apr 5 16:25:46 PDT 2008


To add to what Paul said.  ST_Extent is an aggregate function so you can use
in your case like (note: your insert syntax looks flawed by the way)
    INSERT INTO country_extents (country, geom) 
	SELECT
		country,ST_Extent(point) 
	FROM waypoint 
	GROUP BY  country

However ST_ConvexHull is not an aggregate function.  Hmm and I've never used
it, but I suspect you will have to do the below if you want convexhull for
the country.

	INSERT INTO country_convexhull(country, geom)
	SELECT country, ST_ConvexHull(ST_Collect(point))
		FROM waypoint
	GROUP BY country

I am assuming your points are POINT geometries and not MULTIPOINT.  If
MULTIPOINT, you may need to replace ST_Collect with ST_UNION.

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 Paul
Ramsey
Sent: Saturday, April 05, 2008 6:00 PM
To: PostGIS Users Discussion
Subject: Re: [postgis-users] bounday or convex hull of a bunch of points

st_extent for a minimal bounding box
st_convexhull for a hull

On Sat, Apr 5, 2008 at 1:08 PM, Paul Tomblin <ptomblin at xcski.com> wrote:
> I have a table with a point column.  Is there a way to find the 
> boundary or convex hull of some of the entries in that table?  For 
> instance, if I want to find the extents of each country in the table, can
I say
>         insert into country_extents (country, geom) values (select 
> country,
> ST_XXX(point) from waypoint group by country));
>
>  --
>  Paul Tomblin <ptomblin at xcski.com> http://blog.xcski.com/  "I'm 
> cruising down the Information Superhighway in high gear, surfing the  
> waves of the Digital Ocean, exploring the uncharted regions of Cyberspace.
>  Actually I'm sitting on my butt staring at a computer screen."
>  _______________________________________________
>  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