Function for getting spherical area

This commit is contained in:
Tim Schaub
2017-08-10 18:30:42 -06:00
parent 92c62e5432
commit 94fb7ca5a6
3 changed files with 116 additions and 17 deletions

View File

@@ -177,3 +177,23 @@ describe('ol.Sphere.getLength()', function() {
});
});
describe('ol.Sphere.getArea()', function() {
var geometry;
before(function(done) {
afterLoadText('spec/ol/format/wkt/illinois.wkt', function(wkt) {
try {
var format = new ol.format.WKT();
geometry = format.readGeometry(wkt);
} catch (e) {
done(e);
}
done();
});
});
it('calculates the area of Ilinois', function() {
var area = ol.Sphere.getArea(geometry, {projection: 'EPSG:4326'});
expect(area).to.equal(145652224192.4434);
});
});