[postgis-users] (mistake )plpgsql function for surface of multipolygon with holes

strk strk at keybit.net
Thu Jan 29 10:50:18 PST 2004


If I remember well your problem is about holes,
so you should sum area2d(ExteriorRing(geometryN(the_geom, N))); 

(you missed the ExteriorRing call)

--strk;

davidtecher wrote:
> I made a mistake :{
> 
> -------- aire_geometrique ----------------
> 
> DROP FUNCTION aire_geometrique(geometry); 
> 
> CREATE FUNCTION aire_geometrique(geometry) RETURNS
> real AS' 
> 
> DECLARE 
> --tableau alias for $2;
> colonne_geometrique ALIAS FOR $1; 
> aire real;
> aire_en_cours real;
> iter_aire integer; 
> nombre_d_objects integer;
> BEGIN 
> 	aire=0;
> 	iter_aire = 1;
>   SELECT INTO nombre_d_objects 
>   numgeometries(colonne_geometrique);
> 	while iter_aire < (nombre_d_objects+1)
> 	loop
> 		select into aire_en_cours 
> 		area2d(geometryn(colonne_geometrique,iter_aire));
> 		iter_aire = iter_aire + 1;
> 		aire = aire + aire_en_cours;
> 	end loop;
> RETURN aire; 
> 
> END; 
> 
> ' LANGUAGE 'plpgsql'; 
> 
> --------------------------------------------
> 
> 
> _________________________________________________________________
> Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
> Yahoo! Mail : http://fr.mail.yahoo.com
> _______________________________________________
> 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