ng.geotranslation
A client-side service presenting various methods for the calculation of geospatial metadata between points and sanitization of input/outputs.
Use-cases
- You don't need "duration" properties that Google's distance calculator offers.
- Your backend calculates distance with limitations.
- Interest in unloading server time with calculations distributed across clients,
and cached on clients. (The client should always cache appropriately.)
Install
$ bower install ng.geotranslation
Development
$ grunt compile
$ python -c 'import SimpleHTTPServer; SimpleHTTPServer.test()'
$ open ./example/page1.html
Usage
angular.module('YrApp', ['ngGeotranslation'])
.controller([
'$$geotranslate',
function ($$geotranslate) {
// @note L/l should be floats.
// Initial and final bearing (which may differ).
var bearing1 = $$geotranslate.bearingFrom(L1, l1, L2, l2);
var bearing2 = $$geotranslate.bearingTo(L1, l1, L2, l2);
// Get direction.
var direction = $$geotranslate.direction(L1, l1, L2, l2);
// Get distance.
var distance1 = $$geotranslate.equirectangular(L1, l1, L2, l2); // @needs fix
var distance2 = $$geotranslate.spherical(L1, l1, L2, l2); // @needs fix
var distance3 = $$geotranslate.haversine(L1, l1, L2, l2);
}
]);
Dependencies
See bower.json
.
Review
-
http://www.yourhomenow.com/house/haversine.html
Expand input types.