[mapguide-users] Wish List

Jason Birch Jason.Birch at nanaimo.ca
Tue Apr 10 16:33:29 EDT 2007


Kori wrote:
 >  Dim l_dArea as double = l_oMgPolygon.Area

 

As Kori mentioned, you could do this pretty easily without a feature
source:

 

$wktReaderWriter = new MgWktReaderWriter();
$poly = $wktReaderWriter->Read(
   "POLYGON ( ( 1 1 , 1 2 , 2 1 , 1 1 ) )");
print $poly->GetArea();


Note that this doesn't give meaningful results for non-projected
coordinate systems.  To do this properly, you'd likely want to project
into an appropriate system (UTM is fairly easy to determine
programmatically) and run the area calculation on the projected
geometry.  There would also need to be some unit handling/conversion
stuff in place for a generic tool, as well as checks to make sure you
have a valid polygon, etc.

 

Jason

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20070410/07a84c2f/attachment.html


More information about the mapguide-users mailing list