Merge pull request #6893 from tchandelle/decimals

Fix decimals options when writing features
This commit is contained in:
Andreas Hocevar
2017-06-09 09:27:08 +02:00
committed by GitHub
2 changed files with 21 additions and 8 deletions

View File

@@ -826,6 +826,20 @@ describe('ol.format.GeoJSON', function() {
});
expect(format.readGeometry(geojson).getCoordinates()).to.eql(
[[42.123457, 38.987654], [43, 39]]);
expect(linestring.getCoordinates()).to.eql(
[[42.123456789, 38.987654321], [43, 39]]);
});
it('rounds a linestring with decimals option = 0', function() {
var linestring = new ol.geom.LineString([[42.123456789, 38.987654321],
[43, 39]]);
var geojson = format.writeGeometry(linestring, {
decimals: 0
});
expect(format.readGeometry(geojson).getCoordinates()).to.eql(
[[42, 39], [43, 39]]);
expect(linestring.getCoordinates()).to.eql(
[[42.123456789, 38.987654321], [43, 39]]);
});
});