# [mapguide-dev] area calculation conversion to meters

Orest Halustchak orest.halustchak at autodesk.com
Sun Dec 3 14:33:57 EST 2006

```Hi,

Yes, converting to a UTM zone would work. However, if the original data is in the US, e.g. Sheboygan, you could project to the corresponding State Plane zone. Then you could do length and area calculations more accurately.

For UTM, central meridian = zone*6 -183.

For lat/long data, the correct way to compute length is on the spheroid. Libraries such as Proj4 or Mentor include distance calculation functions based on a particular spheroid. Most libraries unfortunately do not include an area calculation on the spheroid.

Orest.

-----Original Message-----
From: Paul Spencer (External)
Sent: Sun 12/3/2006 2:11 PM
To: dev at mapguide.osgeo.org
Cc:
Subject: Re: [mapguide-dev] area calculation conversion to meters

Thanks Traian, it hurts my head too!  All calculations will be
advertised as approximate, but I'd like them to be close to reality.

How can I construct a UTM coordinate system definition centered
around the meridian that crosses the centroid of the feature?  Or
find the UTM Zone projection that contains the centroid of a feature
(I manually found it for the Sheboygan data and it gave decent
results)?  Would I need to manually build an array of UTM Zone -> LL
mappings?

Cheers

Paul

On 3-Dec-06, at 12:58 PM, Traian Stanev wrote:

> I'm far from an expert either, but here is what makes sense to me...
>
> The simplest solution to me seems to transform to the nearest UTM
> Zone projection in meters and compute the area of the resulting
> geometry. I think this will be accurate enough for what you are
> doing, since it is very likely that the original data (for
> Sheboygan) was measured in that UTM zone and then converted to
> LatLon after the fact anyway. That's why it seems to me that this
> approach will give you exact results, even though in theory it is
> not exact (since the data can be far away from the UTM Zone's
> central meridian).
>
> Another, more generic approach, that would be good for small
> features, would be to construct a UTM coordinate system definition
> centered around the meridian that crosses the centroid of the
> feature. This will give you an LL-UTM transformation with the least
> distortion for the feature at hand.
>
> My hunch is that computing an exact area on the ellipsoid without
> projection involves elliptical integrals, since even the area of a
> whole ellipsoid involves those. Elliptic integrals have no closed
> form solution so you would need a numerical integration approach,
>
>
> Traian
>
>
>
>
> -----Original Message-----
> From: Paul Spencer (External)
> Sent: Sat 12/2/2006 12:04 PM
> To: dev at mapguide.osgeo.org
> Cc:
> Subject: Re: [mapguide-dev] area calculation conversion to meters
>
> Trevor,
>
> That would work for GetLength() but I wonder if you need to adjust
> for latitude as well ... and it doesn't work for area.  I pondered
> doing this for the square root of the area and then squaring the
> result ... I think that would work, but again it would have to be
> adjusted for the latitude ... or am I over-engineering this?
>
> Paul
>
> On 1-Dec-06, at 4:10 PM, Trevor Wekel wrote:
>
> > Hi Paul,
> >
> > For the most general case, I think you're on the right track.
> Most of
> > the geometry classes support the Transform() operation.  The
> > MgCoordinateSystemTransform allows transformation from one
> coordinate
> > system to another.  I'm not a coordinate system expert but from
> what I
> > understand most coordinate systems projections have an accurate
> sweet
> > spot in the center and become more inaccurate around the edges.  I
> > wonder if there is a programmatic way to determine the
> appropriateness
> > of the target system?  Possibly based on center point of the
> > projection?
> >
> > But if your target system is in decimal degrees, doesn't that
> imply a
> > direct mapping to the world space?  Isn't a decimal degree some
> number
> > of meters?  Could you just use
> > MgCoordinateSystem::ConvertCoordinateSystemUnitsToMeters(double
> units)
> > as the conversion factor?  I suspect this may also work in the sweet
> > spot of projected systems as well.
> >
> > Thanks,
> > Trevor
> >
> > -----Original Message-----
> > From: Paul Spencer (External)
> > Sent: Thursday, November 30, 2006 3:03 PM
> > To: dev at mapguide.osgeo.org
> > Subject: [mapguide-dev] area calculation conversion to meters
> >
> > Hi all,
> >
> > I'm measuring the area and length of features using
> > MgGeometricEntity::GetArea() and GetLength() in the Sheboygan data.
> > This returns values in the units of the projection, which happens
> > to be
> > decimal degrees.  Not so useful.  I'd like the result to be in
> meters.
> >
> > Since this code needs to be generic, I've implemented some stuff to
> > transform the geometry into a coordinate system that supports
> meters.
> > This is not too accurate since I arbitrarily picked a World LCC
> > projection wkt :)
> >
> > What is the recommended way of doing this calculation?
> >
> > Cheers
> >
> > Paul
> >
> > +-----------------------------------------------------------------+
> > |Paul Spencer                          pspencer at dmsolutions.ca    |
> > +-----------------------------------------------------------------+
> > |Chief Technology Officer                                         |
> > |DM Solutions Group Inc                http://www.dmsolutions.ca/ |
> > +-----------------------------------------------------------------+
> >
> >
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe at mapguide.osgeo.org
> > For additional commands, e-mail: dev-help at mapguide.osgeo.org
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe at mapguide.osgeo.org
> > For additional commands, e-mail: dev-help at mapguide.osgeo.org
> >
>
> +-----------------------------------------------------------------+
> |Paul Spencer                          pspencer at dmsolutions.ca    |
> +-----------------------------------------------------------------+
> |Chief Technology Officer                                         |
> |DM Solutions Group Inc                http://www.dmsolutions.ca/ |
> +-----------------------------------------------------------------+
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe at mapguide.osgeo.org
> For additional commands, e-mail: dev-help at mapguide.osgeo.org
>
>

+-----------------------------------------------------------------+
|Paul Spencer                          pspencer at dmsolutions.ca    |
+-----------------------------------------------------------------+
|Chief Technology Officer                                         |
|DM Solutions Group Inc                http://www.dmsolutions.ca/ |
+-----------------------------------------------------------------+

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe at mapguide.osgeo.org
For additional commands, e-mail: dev-help at mapguide.osgeo.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 15686 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapguide-internals/attachments/20061203/eaffd534/attachment.bin
```