[postgis-users] Creating a simple polygon encompassing a given number of points

Paolo Corti pcorti at gmail.com
Tue Sep 11 00:18:58 PDT 2012


On Tue, Sep 11, 2012 at 3:44 AM, René Fournier <m5 at renefournier.com> wrote:
> Thanks Nicolas,
>
> UPDATE territories SET border =
> ST_ConvexHull(ST_Collect(ST_GeomFromText('MULTIPOINT(50.569455 -111.868842,
> 50.569992 -111.898634, 50.583764 -111.907919, 50.569452 -111.868859)') ) )
> WHERE id = 3014;
> ERROR:  cannot use aggregate function in UPDATE
> LINE 1: UPDATE territories SET border = ST_ConvexHull(ST_Collect(ST_...
>

Using a sub-select should work:

UPDATE territories SET border = (SELECT
ST_ConvexHull(ST_Collect(ST_GeomFromText('MULTIPOINT(50.569455
-111.868842, 50.569992 -111.898634, 50.583764 -111.907919, 50.569452
-111.868859)') ) ))
WHERE id = 3014;

regards
p

-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti



More information about the postgis-users mailing list