<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<b>Good evening</b><br>
<br>
Of course thank you again i fully agree with what you found which is
mathematically correct ,<br>
it was not easy to find, and is essential for debugging the
calculation of ellipsoîdal distances<br>
<br>
I just had a quick look at the code found at
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/qgis/browser/trunk/qgis/src/core/qgsdistancearea.cpp#L540">http://trac.osgeo.org/qgis/browser/trunk/qgis/src/core/qgsdistancearea.cpp#L540</a>
<br>
<br>
i'm not an informatician so i can just say few words <br>
<br>
inverse flattening seems correctly defined in line 148 as <br>
mInvFlattening <span class="o">=</span> mSemiMajor <span class="o">/</span> <span
class="p">(</span> mSemiMajor <span class="o">-</span> mSemiMinor <span
class="p">)<br>
<br>
therefater the bug that you found could be in line 153 </span><span
class="o"></span><span class="o"></span><span class="p"></span><span
class="o"></span><span class="p"></span>(and may be in some other
lines of the code, i cannot say)<br>
<br>
Therafter, it is just a detail (and a convention) but <br>
just to try to help to avoid a potential confusion in the future code
maintenance. , <br>
about the letter "f" used in your message about "inverse flattening" i
think that it would may be better to use another letter than f for
designation of inverse flattening ... I say this just because in
line 550 of the code found today at
<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/qgis/browser/trunk/qgis/src/core/qgsdistancearea.cpp#L540">http://trac.osgeo.org/qgis/browser/trunk/qgis/src/core/qgsdistancearea.cpp#L540</a>
the letter f was already assigned as f = 1/mInvFlattening, indicating
that letter f in this code is already reserved for ... flattening) <br>
<br>
So of course and again what you said is perfecly correct from a
mathematical point of view (as long as you say, by convention, that f
= inverse flattening) , <br>
Therefore the demonstration would may be a bit clearer just with
replacing this letter f by some other symbol or combination of symbols
for the designation of inverse flattening <br>
(as this f is already used for something else in the code). <br>
Would it be possible for instance to use the symbolic combination <b>rf</b>,
used in proj4 (for "reciprocal flattening" which is, as far as i
know, in english, equivalent to inverse flattening) <br>
<br>
then this would give, from what you found this morning , and with
exactly the same meaning that what you said :<br>
<br>
"<br>
<b>In Qgis the semi-minor axis of the ellipsoid is calculated with:<br>
b = a - (rf/a)<br>
where<br>
b = semi-minor axis<br>
a = semi-major axis<br>
rf = inverse flattening (= "reciprocal flattening" = a/(a-b) )<br>
<br>
while it should be:<br>
b = a - (a/rf)</b><br>
"<br>
<br>
therefore, this rf symbol would also fit with the +rf proj4 parameter
defined as <br>
"+rf reciprocal of the ellipsoid flattening term (e.g. 298)"<br>
(also in proj4 +f is used for flattening<br>
+f Flattening of the ellipsoid (often presented as an inverse,
e.g. 1/298) <br>
<br>
(by the way , I guess, however, that the adjective reciprocal for
"reciprocal numbers" can have also some other meanings for the pure
mathematicians .. <br>
... Therefore it would also be possible to use another symbol for
inverse flattening than rf (but preferentially not f (:-))<br>
<br>
<b>Thank you again<br>
<br>
Best regards<br>
</b><br>
Le 06/04/2012 14:15, G. Allegri a écrit :
<blockquote
cite="mid:20120406121540.E9A1EAACC32@fx405.security-mail.net"
type="cite">Not at all.
<div>The change has already been committed to the development version.</div>
<div><br>
</div>
<div>giovanni</div>
<br>
<div class="gmail_quote">2012/4/6 blavet <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:didier.blavet@ird.fr">didier.blavet@ird.fr</a>></span><br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div text="#000000" bgcolor="#ffffff">
Thank you very much for this very fast and efficient diagnosis<br>
<br>
Best regards<br>
<br>
Didier Blavet<br>
<br>
Le 06/04/2012 12:01, G. Allegri a écrit :
<blockquote type="cite">Probably I've found the bug.
<div>In Qgis the semi-minor axis of the ellipsoid is calculated
with:</div>
<div><br>
</div>
<div>b = a - (f/a)</div>
<div><br>
</div>
<div>where </div>
<div>b = semi-minor axis</div>
<div>a = semi-majot axis</div>
<div>f = inverse flattening</div>
<div><br>
</div>
<div>while it should be:</div>
<div><br>
</div>
<div>b = a - (a/f)</div>
<div><br>
</div>
<div><br>
</div>
<div>In Qgis the WGS84 semi-minor axis is 6378136,xxx</div>
<div>while it should be 6356752.xxx</div>
<div><br>
</div>
<div>giovanni</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
<br>
<div class="gmail_quote">2012/4/6 G. Allegri <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:giohappy@gmail.com" target="_blank">giohappy@gmail.com</a>></span><br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><span>AFAICS, the Qgis formula [1] to calculate
distances on ellipssoid is Vincenty's.</span>
<div>I've reproduced it for the first set of points and I can
confirm tha QGis gives 540.9973919726176 m</div>
<div><br>
</div>
<div>The online Vincenty calculator [2] gives 540.045 m</div>
<div><br>
</div>
<div>I suppose it's a rounding issue. </div>
<div>I will investigate it more...</div>
<div><br>
</div>
<div>giovanni</div>
<div><br>
<div><br>
</div>
<div>[1] <a moz-do-not-send="true"
href="http://trac.osgeo.org/qgis/browser/trunk/qgis/src/core/qgsdistancearea.cpp#L540"
style="color: rgb(17, 85, 204);" target="_blank">http://trac.osgeo.org/qgis/browser/trunk/qgis/src/core/qgsdistancearea.cpp#L540</a> </div>
<div>[2] <a moz-do-not-send="true"
href="http://www.movable-type.co.uk/scripts/latlong-vincenty.html"
style="color: rgb(17, 85, 204);" target="_blank">http://www.movable-type.co.uk/scripts/latlong-vincenty.html</a> </div>
</div>
<br>
</div>
<div class="gmail_quote">2012/4/6 blavet <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:didier.blavet@ird.fr"
target="_blank">didier.blavet@ird.fr</a>></span><br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div>
<div text="#000000" bgcolor="#ffffff">Dear QGis Developpers
and
Users <br>
<br>
<br>
<div>
<p style="margin-bottom: 0cm;"><font>_______________________________________________________________________________________</font></p>
<p style="margin-bottom: 0cm;"><font color="#008000"><font><b>Didier
B</b><b>lavet</b> </font></font> </p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>Institut
de
Recherche
pour
le Développement - IRD (<font color="#0000ff"><a moz-do-not-send="true"
href="http://www.ird.fr" target="_blank">http://www.ird.fr</a></font>)
</font></font></p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>UMR
Eco&Sols
- Ecologie Fonctionnelle & Biogéochimie des Sols &
Agroécosystèmes </font></font> </p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>(Montpellier
SupAgro-CIRAD-INRA-IRD)
(<font color="#0000ff"><a moz-do-not-send="true"
href="http://www.montpellier.inra.fr/ecosols" target="_blank">http://www.montpellier.inra.fr/ecosols</a></font><span
style="font-style: normal;">)</span></font></font></p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>Bâtiment
12,
2
place
Viala, F-34060 Montpellier Cedex 2 , France </font></font> </p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>Tel
bureau
: <a moz-do-not-send="true"
href="tel:%2B33%20%280%294%2099%2061%2021%2033" value="+33499612133"
target="_blank">+33 (0)4 99 61 21 33</a> </font></font> </p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>Secrétariat
:
<a moz-do-not-send="true"
href="tel:%2B33%20%280%294%2099%2061%2021%2001" value="+33499612101"
target="_blank">+33 (0)4 99 61 21 01</a> / Fax : <a
moz-do-not-send="true" href="tel:%2B33%20%280%294%2099%2061%2021%2019"
value="+33499612119" target="_blank">+33 (0)4 99 61 21 19</a> </font></font>
</p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>Courriel
:
<font color="#0000ff"><a moz-do-not-send="true"
href="mailto:didier.blavet@ird.fr" target="_blank">didier.blavet@ird.fr</a></font>
</font></font> </p>
<p style="margin-bottom: 0cm;"><font>_______________________________________________________________________________________</font></p>
</div>
</div>
<br>
</div>
</div>
<div>_______________________________________________<br>
Qgis-user mailing list<br>
<a moz-do-not-send="true"
href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
<a moz-do-not-send="true"
href="http://lists.osgeo.org/mailman/listinfo/qgis-user"
target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
<br>
</div>
</blockquote>
</div>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<div>-- <br>
<p style="margin-bottom: 0cm;"><font>_______________________________________________________________________________________</font></p>
<p style="margin-bottom: 0cm;"><font color="#008000"><font><b>Didier
B</b><b>lavet</b> </font></font>
</p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>Institut
de
Recherche pour le Développement - IRD (<font color="#0000ff"><a
moz-do-not-send="true" href="http://www.ird.fr" target="_blank">http://www.ird.fr</a></font>)
</font></font></p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>UMR
Eco&Sols - Ecologie Fonctionnelle & Biogéochimie des Sols &
Agroécosystèmes </font></font>
</p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>(Montpellier
SupAgro-CIRAD-INRA-IRD)
(<font color="#0000ff"><a moz-do-not-send="true"
href="http://www.montpellier.inra.fr/ecosols" target="_blank">http://www.montpellier.inra.fr/ecosols</a></font><span
style="font-style: normal;">)</span></font></font></p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>Bâtiment
12,
2 place Viala, F-34060 Montpellier Cedex 2 , France </font></font>
</p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>Tel
bureau : <a moz-do-not-send="true"
href="tel:%2B33%20%280%294%2099%2061%2021%2033" value="+33499612133"
target="_blank">+33 (0)4 99 61 21 33</a> </font></font>
</p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>Secrétariat
:
<a moz-do-not-send="true"
href="tel:%2B33%20%280%294%2099%2061%2021%2001" value="+33499612101"
target="_blank">+33 (0)4 99 61 21 01</a> / Fax : <a
moz-do-not-send="true" href="tel:%2B33%20%280%294%2099%2061%2021%2019"
value="+33499612119" target="_blank">+33 (0)4 99 61 21 19</a> </font></font>
</p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font>Courriel
:
<font color="#0000ff"><a moz-do-not-send="true"
href="mailto:didier.blavet@ird.fr" target="_blank">didier.blavet@ird.fr</a></font>
</font></font>
</p>
<p style="margin-bottom: 0cm;"><font>_______________________________________________________________________________________</font></p>
</div>
</div>
</blockquote>
</div>
<br>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=ISO-8859-1">
<title></title>
<meta name="GENERATOR" content="OpenOffice.org 3.2 (Unix)">
<meta name="AUTHOR" content="Didier Blavet">
<meta name="CREATED" content="20101221;13534200">
<meta name="CHANGEDBY" content="Didier Blavet">
<meta name="CHANGED" content="20101221;14074700">
<style type="text/css">
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
A:link { so-language: zxx }
-->
</style>
<p style="margin-bottom: 0cm;"><font size="2">_______________________________________________________________________________________</font></p>
<p style="margin-bottom: 0cm;"><font color="#008000"><font size="2"><b>Didier
B</b><b>lavet</b> </font></font>
</p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font size="2">Institut
de
Recherche pour le Développement - IRD (<font color="#0000ff"><a class="moz-txt-link-freetext" href="http://www.ird.fr">http://www.ird.fr</a></font>)
</font></font></p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font size="2">UMR
Eco&Sols - Ecologie Fonctionnelle & Biogéochimie des Sols &
Agroécosystèmes </font></font>
</p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font size="2">(Montpellier
SupAgro-CIRAD-INRA-IRD)
(<font color="#0000ff"><a class="moz-txt-link-freetext" href="http://www.montpellier.inra.fr/ecosols">http://www.montpellier.inra.fr/ecosols</a></font><span
style="font-style: normal;">)</span></font></font></p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font size="2">Bâtiment
12,
2 place Viala, F-34060 Montpellier Cedex 2 , France </font></font>
</p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font size="2">Tel
bureau : +33 (0)4 99 61 21 33 </font></font>
</p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font size="2">Secrétariat
:
+33 (0)4 99 61 21 01 / Fax : +33 (0)4 99 61 21 19 </font></font>
</p>
<p style="margin-bottom: 0cm;"><font color="#000000"><font size="2">Courriel
:
<font color="#0000ff"><a class="moz-txt-link-abbreviated" href="mailto:didier.blavet@ird.fr">didier.blavet@ird.fr</a></font> </font></font>
</p>
<p style="margin-bottom: 0cm;"><font size="2">_______________________________________________________________________________________</font></p>
</div>
</body>
</html>