Boost logo

Geometry :

Subject: Re: [geometry] Support for geographic coordinate system
From: Barend Gehrels (barend_at_[hidden])
Date: 2014-11-27 13:38:00


Hi Adam,

Adam Wulkiewicz wrote On 27-11-2014 1:40:
> Hi Barend,
>
> 2014-11-26 23:22 GMT+01:00 Barend Gehrels <barend_at_[hidden]
> <mailto:barend_at_[hidden]>>:
>
>
> Adam Wulkiewicz wrote On 26-11-2014 21:25:
>>
>> Of course in all formulas some approximation of a globe is used.
>> My assessment is based on a fact that SSF assume thet a globe is
>> a sphere
>
> Ah, so you did *not *read my blog, and apparently also not my
> statements that SSF can be used on a spheroid.
>
>
> Of course I *did* read it.

OK, good, then can we now discuss the spheroid properties of the SSF.

> So I repeat it again, there it goes:
>
> http://barendgehrels.blogspot.nl/2011/06/spherical-side-formula.html
>
> Quoting, a.o.:
> "Summary: Using some high-school mathematics I presented an
> algorithm and a formula to calculate at which side a point is with
> resepect to a segment, on a sphere or on the Earth"
>
> Beside the summary, it has a whole paragraph about the Ellipsoid.
>
> Because this is exact, and Vincenty is an approximation (close to
> reality, but still, an approximation), I now just assume that
> these results are correct and the Vincenty approximation is off
> within ranges of 0.6.
>
> I assume that, until it is proven that it is the other way round...
>
>
> The paragraph about the Earth, corresponding planes, etc. would be
> true only if a shape of spherical geodesic and ellipsoidal one was the
> same.

I don't write about geodesic there. What is calculated is a plane
through the center of the Earth, and the two points involved. What is
determined is if it is left or right from the plane. That is exact, also
for a spheroid.

So what is written there is basically true, but... indeed the plane
going through the center of the Earth does not encompass the geodesic.
So if we want to have it comparable with the geodesic shortest distance
calculations, it cannot be used together.

What is defined there is the "great elliptic arc" or "great ellipse"
(comparable to great circle, but on a spheroid) and "The great ellipse
is not the shortest path between two points on the Earth's surface".

> In other words, it would be true if all intermediate points of a
> segment was going through the same coordinates. Are you sure that this
> is the case? I'm not. My test seems to prove that this is not true or
> at least that a method (Vincenty) which is known for giving precise
> results for an ellipsoid gives different results than SSF. Of course
> this is more visible for greater flattening.

OK. Vincenty is precise but very slow (maybe you have to compare
performance too). At least distance calculations and comparisons I did
in the past, comparing with Andoyer, Vincenty was much slower.

If we are going to use side-information on ellipsoids we have to have a
reasonably fast algorithm, the side calculations are used very very
often. The SSF is already slower of course than the cartesian calculation.

If the difference is very small, and the results of SSF-only are
mutually consistent, and we don't use it together with distances (I
don't think we do - but we use fractions which have to be comparable) it
is not impossible that we can still use it (needs more research). It is
just a different method to calculate the side, and if we can use that
for turn-calculations and point-in-polygon calculations, it might give
the correct results. Other libraries or packages first project to a
Cartesian coordinate system, do the operation and convert back - you
will also loose some information there too.
I don't state that it is possible, we just can research the possibilities.

Furthermore the formulas given (on that blog) and probably also what is
implemented for SSF are about spheres. For the ellipsoid x,y,z have to
be calculated differently, taking axis lengths into account. That might
(most probably will) result in different results. It has to be
implemented. That is the phase where we are.

>
> If SSF was only applicable for 100% spheres, the error would be
> much larger. Compare Haversine/Vincenty, it can be off many
> kilometers.
>
>
> Yes, it's not surprising that the distance may be more influenced. I'm
> guessing that in the case of distance more important is the difference
> between major an minor axes than the actual shape of the shortest
> path. Still it doesn't mean that a side is calculated correctly.
>
> Note: it is different from distance, where an exact mathematical
> formula for ellips or spheroid just does not exist.
>
>
> AFAIU it's the same for ellipsoid. And greater the flattening, greater
> the difference. See the picture for flattening = 0.5.
>
>> and Vincenty that it's a spheroid. So the approximation is closer
>> to reality. And the greater the flattening, the greater the
>> difference between SSF and Vincenty. I'm not considering
>> precision, numerical errors, stability etc.
>> As for the Vincenty formula here:
>> http://www.icsm.gov.au/gda/gdav2.3.pdf states:
>> "Vincenty's formulae (Vincenty, 1975) may be used for lines
>> ranging from a few cm to nearly 20,000 km, with millimetre accuracy."
>> Calculation done with SSF is probably also precise but it uses a
>> sphere model, that's all.
>
> Nope.
>
>
> Do you have an idea how we could verify this?
>

No... or basically it is probably already clear now. The methods are
different.

Regards, Barend



Geometry list run by mateusz at loskot.net