Ticket #2692 (closed feature: fixed)

Opened 3 years ago

Last modified 3 years ago

Add vincenty direct formula

Reported by: aabt Owned by:
Priority: minor Milestone: 2.10 Release
Component: Util Version: 2.9
Keywords: Cc:
State: Complete

Description

Hi,

In Util.js we got the vincenty inverse formula. Attached patch add the direct formula, and move both into their own Vincenty namespace( got some common constants).

It keeps compatibility with previous distVincenty function.

Credits to Chris Veness[1], his work is under CC-BY.

Please review,

1 -  http://www.movable-type.co.uk/scripts/latlong-vincenty-direct.html

Attachments

vincenty_2692_r10408.diff Download (10.9 KB) - added by aabt 3 years ago.
vincenty_2692_r10408_A1.diff Download (4.1 KB) - added by aabt 3 years ago.
vincenty_2692_r10408_A2.diff Download (4.4 KB) - added by elemoine 3 years ago.

Change History

Changed 3 years ago by aabt

Changed 3 years ago by elemoine

  • state changed from Review to Needs More Work

Antoine, thanks for the patch. Some comments:

  • MouseToolbar.js, ScaleLine.js and Curve.js now @require Vicenty.js
  • but actually I don't see much value in moving the Vincenty functions in a separate file, and it would break existing applications that rely on OpenLayers builds
  • note that we don't use @include in OpenLayers files, as this directive isn't supported by OpenLayers' build script

So I'd rather see OpenLayers.Util.destinationVincenty. I hope you agree with that.

Changed 3 years ago by elemoine

One additional note: I know OpenLayers.Util.destVincenty isn't public, but I would be conservative here and would not move it. However we can add a note mentioning that these Vincenty functions could be moved in a separate file in 3.0.

Changed 3 years ago by aabt

Thanks for the comments.

My goal, in moving to the its own namespace, was not to increase the size of Util where you already some “inconsistent” content, from getScrollbarSize to distVincenty. And where they don't get the visibility they deserve.

But ok for moving it in 3.0, I'll update my patch…

PS: In my patch, OpenLayers.Util.distVincenty become a proxy to OpenLayers.Vincenty.distance

Changed 3 years ago by aabt

Changed 3 years ago by aabt

  • state changed from Needs More Work to Review

See new patch attached.

Changed 3 years ago by elemoine

Changed 3 years ago by elemoine

Thanks for the updated patch Antoine.

I just attached vincenty_2692_r10408_A2.diff Download. This patch includes a few minor changes:

  • OpenLayers.Vicenty is now OpenLayers.Util.VincentyConstants. I think that everything that's defined in the Util.js file should be in the Util namespace.
  • use <OpenLayers.LonLat> instead of OpenLayers.LonLat in the doc strings, so they appear as links in the HTML documentation.
  • correct one or two typos.
  • also, the patch changes distVincenty and destinationVincenty to API functions. I think it makes sense to make these utility functions public, primarily since we want to use them in GeoExt.

I'll commit this patch in the coming days if I don't get any push back.

Changed 3 years ago by elemoine

  • keywords vincenty removed
  • status changed from new to closed
  • state changed from Review to Complete
  • resolution set to fixed

(In [10425]) Add Vincenty direct formula, and make the Vincenty functions part of the API, p=aabt, r=me (closes #2692)

Note: See TracTickets for help on using tickets.