[Ottawa_users] Lat Long Calculations

Frank Warmerdam warmerdam at pobox.com
Wed Jun 27 14:29:59 EDT 2007

Sampson, David wrote:
> Thanks Frank,
> I was looking into maybe doing a projection to UTM, but I fear problems
> when a distance is calculated across two different UTM zones... Does
> this matter?


It is important that both points can be converted to a projection
that is well behaved (low error) in the area containing the points.
Cross UTM zone edges isn't a problem, but the further you go "out of
the zone" the greater the distortion.  It would likely be better
to use a custom projection centered between your two points.  I'm
not exactly sure what projection would be best though since my
projection "theory" is pretty weak.

> I looked at GEOS and found that there are measurements between geometry
> objects.
> http://geos.refractions.net/ro/doxygen_docs/html/namespacegeos_1_1operat
> ion_1_1distance.html
> But getting into the GEOS library from python is proving a challenge.
> Some posts even note that the measure function is not exposed to the C
> API of Geos (FRANK?)
> http://lists.maptools.org/pipermail/fwtools/2006-March/000318.html.

GEOS is just doing a cartesian, not great circle, calculation.  So
you might as well do it yourself in python.

> So what about the measuremnt function from PCL?  Well I am having to
> battle PCL install on windows using FWTools. If this works I hope this
> is even what I want. Furthermore I hope I can compile and package up an
> application without an FWTOOLS dependency.

I can't speak for what PCL has built in.  I think mixing PCL binaries
and FWTools is likely to be a nightmare though it might be possible
to graft pure python parts of PCL into FWTools.  Generally though if
PCL isn't doing anything special for you, then it likely isn't worth

> I would have thought someone would have a compas.py program that would
> do all this, but I guess it's so simple that everyone reinvents their
> own wheel when they need it. My chissel is not that precise to carve a
> new wheel. (SMILE)

I imagine such a thing exists somewhere.  Finding and integrating may
prove a challenge.  If you are willing to use cartesian distances in
a projection between points then there is really no reason not to do
the distance yourself, using osr.py to reproject things.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org

More information about the Ottawa_users mailing list