[mapguide-dev] area calculation conversion to meters
Jason Birch
Jason.Birch at nanaimo.ca
Sat Dec 2 17:35:29 EST 2006
Not that I have any idea what the Right Thing would be in this case. Perhaps returning a null or an exception because you can't convert reliably between decimal degrees and distance units?
My preferred solution would be to see something like GetAreaInMeters and GetDistanceInMeters functions :)
Jason
________________________________
From: Jason Birch
Sent: Sat 2006-12-02 2:06 PM
To: dev at mapguide.osgeo.org
Subject: RE: [mapguide-dev] area calculation conversion to meters
No, you're not over-engineering Paul. I think it's non-trivial to accurately calculate large areas based on decimal degree coordinates because, as you've said, the vertical distance between decimal degrees varies with latitude.
For distance I think there are a couple methods (haversine, cosine law) you can use without having to rely on a projection library. I don't think that the MapGuide ConvertCoordinateSystemUnitsToMeters function (in \Common\Geometry\CoordinateSystem\CoordinateSystem.cpp) is doing the right thing though. For projected systems it's doing a simple multiplication by conversion factor, but it appears to be doing the same thing for geographic systems, multiplying by a constant:
if(m_ogrSrs->IsGeographic())
{
meters = METERS_PER_DEGREE * units;
}
For area, transforming to an equal-area projection would probably work better than a conformal projection like LCC, but I'm unsure of whether "equal area" applies across the entire projection or just within the "sweet spot".
Jason
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 5205 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapguide_dev/attachments/20061202/1db78b65/attachment.bin
More information about the Mapguide_dev
mailing list