[Mapserver-users] area Calculation in polygon-shapes
woodbri@swoodbridge.com
woodbri@swoodbridge.com
Mon, 02 Feb 2004 09:43:35 -0500
It is easy to calculate just get the polygon shape object and extract
the polygon vertices. Then walk through the line segment and sum the
area under the line segment. Or if the vertex points are in array v
then in sudo-code:
area = 0;
for (i=1; i<numPoints; i++) {
area = area + (v[i].x - v[i-1].x)*(v[i-1].y + (v[i].y - v[i-
1].y)/2.0);
}
// and close the gap if any between the last and the first
area = area + (v[0].x - v[numPoints-1].x)*(v[numPoints-1].y + (v[0].y
- v[numPoints-1].y)/2.0);
Hope this helps.
-Steve W.
On 2 Feb 2004 at 14:16, Margaritha Vogt wrote:
> Hello,
> is there an existing function in PHP-MapScript to calculate areas from a
> polygon-shape
> (like "shape.return area" in ArcView).
> Or any other possibility to get area and perimeters from shapes?
> Thanks for answering
> Maggy
>
> --
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> * Dipl.-Ing.(FH) Margaritha Vogt
> * FH Mainz, FR Geoinformatik
> * Holzstrasse 36, D-55116 Mainz
> * Tel: +49-6131-2859-612, Fax: +49-6131-2859-615
> * mailto:vogt@geoinform.fh-mainz.de
> * http://www.geoinform.fh-mainz.de
>
>
> _______________________________________________
> Mapserver-users mailing list
> Mapserver-users@lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
_______________________________________________
Mapserver-users mailing list
Mapserver-users@lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users