Changes between Version 1 and Version 2 of UsersWikiComputeMultiCentroid


Ignore:
Timestamp:
May 26, 2009, 3:23:53 AM (15 years ago)
Author:
Mike Taves
Comment:

clean up

Legend:

Unmodified
Added
Removed
Modified
  • UsersWikiComputeMultiCentroid

    v1 v2  
    11= Compute Multi Centroid =
    2 
    3 
    42
    53{{{
     
    108 --
    119 -- Usage:
    12  -- postgis=# select [ST_AsText|http://postgis.refractions.net/documentation/manual-svn/ST_AsText.html](ST_!MultiCentroid(
     10 -- postgis=# select ST_AsText.html(ST_MultiCentroid(
    1311 -- postgis(#       'MULTIPOLYGON (
    1412 -- postgis'#         (( 0 0, 0 1, 1 1, 1 0, 0 0 )),
     
    2018 --( 1 row)
    2119 --
    22  -- DROP FUNCTION ST_!MultiCentroid(geometry);
     20 -- DROP FUNCTION ST_MultiCentroid(geometry);
    2321
    24  CREATE OR REPLACE FUNCTION ST_!MultiCentroid(geometry)
     22 CREATE OR REPLACE FUNCTION ST_MultiCentroid(geometry)
    2523   RETURNS geometry AS
    26  $BODY$SELECT [ST_Collect|http://postgis.refractions.net/documentation/manual-svn/ST_Collect.html](the_geom)
     24 $BODY$SELECT ST_Collect(the_geom)
    2725 FROM (
    28   SELECT [ST_Centroid|http://postgis.refractions.net/documentation/manual-svn/ST_Centroid.html](([ST_Dump|http://postgis.refractions.net/documentation/manual-svn/ST_Dump.html]([ST_Multi|http://postgis.refractions.net/documentation/manual-svn/ST_Multi.html]($1))).geom) AS the_geom
     26  SELECT ST_Centroid((ST_Dump(ST_Multi($1))).geom) AS the_geom
    2927 ) AS foo;$BODY$
    3028   LANGUAGE 'sql' IMMUTABLE
    3129   COST 100;
    32 
    3330}}}