Use blocked scoped variables
In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
This commit is contained in:
File diff suppressed because it is too large
Load Diff
+186
-186
@@ -13,12 +13,12 @@ import {fromLonLat, get as getProjection, toLonLat, transform} from '../../../..
|
||||
|
||||
describe('ol.format.GeoJSON', function() {
|
||||
|
||||
var format;
|
||||
let format;
|
||||
beforeEach(function() {
|
||||
format = new GeoJSON();
|
||||
});
|
||||
|
||||
var pointGeoJSON = {
|
||||
const pointGeoJSON = {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Point',
|
||||
@@ -29,7 +29,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
}
|
||||
};
|
||||
|
||||
var nullGeometryGeoJSON = {
|
||||
const nullGeometryGeoJSON = {
|
||||
'type': 'Feature',
|
||||
'geometry': null,
|
||||
'properties': {
|
||||
@@ -37,7 +37,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
}
|
||||
};
|
||||
|
||||
var zeroIdGeoJSON = {
|
||||
const zeroIdGeoJSON = {
|
||||
'type': 'Feature',
|
||||
'id': 0,
|
||||
'geometry': null,
|
||||
@@ -46,7 +46,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
}
|
||||
};
|
||||
|
||||
var lineStringGeoJSON = {
|
||||
const lineStringGeoJSON = {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'LineString',
|
||||
@@ -60,7 +60,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
}
|
||||
};
|
||||
|
||||
var polygonGeoJSON = {
|
||||
const polygonGeoJSON = {
|
||||
'type': 'Feature',
|
||||
'geometry': {
|
||||
'type': 'Polygon',
|
||||
@@ -74,12 +74,12 @@ describe('ol.format.GeoJSON', function() {
|
||||
}
|
||||
};
|
||||
|
||||
var featureCollectionGeoJSON = {
|
||||
const featureCollectionGeoJSON = {
|
||||
'type': 'FeatureCollection',
|
||||
'features': [pointGeoJSON, lineStringGeoJSON, polygonGeoJSON]
|
||||
};
|
||||
|
||||
var data = {
|
||||
const data = {
|
||||
'type': 'FeatureCollection',
|
||||
'features': [{
|
||||
'type': 'Feature',
|
||||
@@ -144,37 +144,37 @@ describe('ol.format.GeoJSON', function() {
|
||||
describe('#readFeature', function() {
|
||||
|
||||
it('can read a single point feature', function() {
|
||||
var feature = format.readFeature(pointGeoJSON);
|
||||
const feature = format.readFeature(pointGeoJSON);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(Point);
|
||||
expect(geometry.getCoordinates()).to.eql([102.0, 0.5]);
|
||||
expect(feature.get('prop0')).to.be('value0');
|
||||
});
|
||||
|
||||
it('can read a single point geometry as a feature', function() {
|
||||
var feature = format.readFeature(pointGeoJSON.geometry);
|
||||
const feature = format.readFeature(pointGeoJSON.geometry);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(Point);
|
||||
expect(geometry.getCoordinates()).to.eql([102.0, 0.5]);
|
||||
});
|
||||
|
||||
it('can read a single line string feature', function() {
|
||||
var feature = format.readFeature(lineStringGeoJSON);
|
||||
const feature = format.readFeature(lineStringGeoJSON);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getCoordinates()).to.eql(
|
||||
[[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]);
|
||||
[[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]);
|
||||
expect(feature.get('prop0')).to.be('value0');
|
||||
expect(feature.get('prop1')).to.be(0.0);
|
||||
});
|
||||
|
||||
it('can read a single polygon feature', function() {
|
||||
var feature = format.readFeature(polygonGeoJSON);
|
||||
const feature = format.readFeature(polygonGeoJSON);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(Polygon);
|
||||
expect(geometry.getCoordinates()).to.eql([[
|
||||
[100.0, 0.0], [100.0, 1.0], [101.0, 1.0], [101.0, 0.0]
|
||||
@@ -184,21 +184,21 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('can read a feature with null geometry', function() {
|
||||
var feature = format.readFeature(nullGeometryGeoJSON);
|
||||
const feature = format.readFeature(nullGeometryGeoJSON);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.eql(null);
|
||||
expect(feature.get('prop0')).to.be('value0');
|
||||
});
|
||||
|
||||
it('can read a feature with id equal to 0', function() {
|
||||
var feature = format.readFeature(zeroIdGeoJSON);
|
||||
const feature = format.readFeature(zeroIdGeoJSON);
|
||||
expect(feature).to.be.an(Feature);
|
||||
expect(feature.getId()).to.be(0);
|
||||
});
|
||||
|
||||
it('can read a feature collection', function() {
|
||||
var features = format.readFeatures(featureCollectionGeoJSON);
|
||||
const features = format.readFeatures(featureCollectionGeoJSON);
|
||||
expect(features).to.have.length(3);
|
||||
expect(features[0].getGeometry()).to.be.an(Point);
|
||||
expect(features[1].getGeometry()).to.be.an(LineString);
|
||||
@@ -206,39 +206,39 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('can read and transform a point', function() {
|
||||
var feature = format.readFeatures(pointGeoJSON, {
|
||||
const feature = format.readFeatures(pointGeoJSON, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(feature[0].getGeometry()).to.be.an(Point);
|
||||
expect(feature[0].getGeometry().getCoordinates()).to.eql(
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('uses featureProjection passed to the constructor', function() {
|
||||
var format = new GeoJSON({featureProjection: 'EPSG:3857'});
|
||||
var feature = format.readFeatures(pointGeoJSON);
|
||||
const format = new GeoJSON({featureProjection: 'EPSG:3857'});
|
||||
const feature = format.readFeatures(pointGeoJSON);
|
||||
expect(feature[0].getGeometry()).to.be.an(Point);
|
||||
expect(feature[0].getGeometry().getCoordinates()).to.eql(
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('gives precedence to options passed to the read method', function() {
|
||||
var format = new GeoJSON({featureProjection: 'EPSG:1234'});
|
||||
var feature = format.readFeatures(pointGeoJSON, {
|
||||
const format = new GeoJSON({featureProjection: 'EPSG:1234'});
|
||||
const feature = format.readFeatures(pointGeoJSON, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(feature[0].getGeometry()).to.be.an(Point);
|
||||
expect(feature[0].getGeometry().getCoordinates()).to.eql(
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
it('can read and transform a feature collection', function() {
|
||||
var features = format.readFeatures(featureCollectionGeoJSON, {
|
||||
const features = format.readFeatures(featureCollectionGeoJSON, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(features[0].getGeometry()).to.be.an(Point);
|
||||
expect(features[0].getGeometry().getCoordinates()).to.eql(
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
expect(features[1].getGeometry().getCoordinates()).to.eql([
|
||||
transform([102.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
transform([103.0, 1.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
@@ -254,8 +254,8 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('can create a feature with a specific geometryName', function() {
|
||||
var feature = new GeoJSON({geometryName: 'the_geom'}).
|
||||
readFeature(pointGeoJSON);
|
||||
const feature = new GeoJSON({geometryName: 'the_geom'}).
|
||||
readFeature(pointGeoJSON);
|
||||
expect(feature.getGeometryName()).to.be('the_geom');
|
||||
expect(feature.getGeometry()).to.be.an(Point);
|
||||
});
|
||||
@@ -265,56 +265,56 @@ describe('ol.format.GeoJSON', function() {
|
||||
describe('#readFeatures', function() {
|
||||
|
||||
it('parses feature collection', function() {
|
||||
var str = JSON.stringify(data);
|
||||
var array = format.readFeatures(str);
|
||||
const str = JSON.stringify(data);
|
||||
const array = format.readFeatures(str);
|
||||
|
||||
expect(array.length).to.be(2);
|
||||
|
||||
var first = array[0];
|
||||
const first = array[0];
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('LINK_ID')).to.be(573730499);
|
||||
var firstGeom = first.getGeometry();
|
||||
const firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(LineString);
|
||||
|
||||
var second = array[1];
|
||||
const second = array[1];
|
||||
expect(second).to.be.a(Feature);
|
||||
expect(second.get('ST_NAME')).to.be('BRUNNSGATAN');
|
||||
var secondGeom = second.getGeometry();
|
||||
const secondGeom = second.getGeometry();
|
||||
expect(secondGeom).to.be.a(LineString);
|
||||
});
|
||||
|
||||
it('can parse a polygon geometry as an array of one feature', function() {
|
||||
var features = format.readFeatures(polygonGeoJSON);
|
||||
const features = format.readFeatures(polygonGeoJSON);
|
||||
expect(features).to.be.an(Array);
|
||||
expect(features).to.have.length(1);
|
||||
var geometry = features[0].getGeometry();
|
||||
const geometry = features[0].getGeometry();
|
||||
expect(geometry).to.be.an(Polygon);
|
||||
});
|
||||
|
||||
it('parses countries.geojson', function(done) {
|
||||
afterLoadText('spec/ol/format/geojson/countries.geojson', function(text) {
|
||||
var result = format.readFeatures(text);
|
||||
const result = format.readFeatures(text);
|
||||
expect(result.length).to.be(179);
|
||||
|
||||
var first = result[0];
|
||||
const first = result[0];
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('name')).to.be('Afghanistan');
|
||||
expect(first.getId()).to.be('AFG');
|
||||
var firstGeom = first.getGeometry();
|
||||
const firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(Polygon);
|
||||
expect(_ol_extent_.equals(firstGeom.getExtent(),
|
||||
[60.52843, 29.318572, 75.158028, 38.486282]))
|
||||
.to.be(true);
|
||||
[60.52843, 29.318572, 75.158028, 38.486282]))
|
||||
.to.be(true);
|
||||
|
||||
var last = result[178];
|
||||
const last = result[178];
|
||||
expect(last).to.be.a(Feature);
|
||||
expect(last.get('name')).to.be('Zimbabwe');
|
||||
expect(last.getId()).to.be('ZWE');
|
||||
var lastGeom = last.getGeometry();
|
||||
const lastGeom = last.getGeometry();
|
||||
expect(lastGeom).to.be.a(Polygon);
|
||||
expect(_ol_extent_.equals(lastGeom.getExtent(),
|
||||
[25.264226, -22.271612, 32.849861, -15.507787]))
|
||||
.to.be(true);
|
||||
[25.264226, -22.271612, 32.849861, -15.507787]))
|
||||
.to.be(true);
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -322,8 +322,8 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('generates an array of features for Feature', function() {
|
||||
|
||||
var format = new GeoJSON();
|
||||
var json = {
|
||||
const format = new GeoJSON();
|
||||
const json = {
|
||||
type: 'Feature',
|
||||
properties: {
|
||||
bam: 'baz'
|
||||
@@ -333,11 +333,11 @@ describe('ol.format.GeoJSON', function() {
|
||||
coordinates: [[1, 2], [3, 4]]
|
||||
}
|
||||
};
|
||||
var features = format.readFeatures(json);
|
||||
const features = format.readFeatures(json);
|
||||
|
||||
expect(features.length).to.be(1);
|
||||
|
||||
var first = features[0];
|
||||
const first = features[0];
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('bam')).to.be('baz');
|
||||
expect(first.getGeometry()).to.be.a(LineString);
|
||||
@@ -350,54 +350,54 @@ describe('ol.format.GeoJSON', function() {
|
||||
describe('#readGeometry', function() {
|
||||
|
||||
it('parses point', function() {
|
||||
var str = JSON.stringify({
|
||||
const str = JSON.stringify({
|
||||
type: 'Point',
|
||||
coordinates: [10, 20]
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
const obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(Point);
|
||||
expect(obj.getCoordinates()).to.eql([10, 20]);
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
});
|
||||
|
||||
it('parses linestring', function() {
|
||||
var str = JSON.stringify({
|
||||
const str = JSON.stringify({
|
||||
type: 'LineString',
|
||||
coordinates: [[10, 20], [30, 40]]
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
const obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(LineString);
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20], [30, 40]]);
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
});
|
||||
|
||||
it('parses XYZ linestring', function() {
|
||||
var str = JSON.stringify({
|
||||
const str = JSON.stringify({
|
||||
type: 'LineString',
|
||||
coordinates: [[10, 20, 1534], [30, 40, 1420]]
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
const obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(LineString);
|
||||
expect(obj.getLayout()).to.eql('XYZ');
|
||||
expect(obj.getCoordinates()).to.eql([[10, 20, 1534], [30, 40, 1420]]);
|
||||
});
|
||||
|
||||
it('parses polygon', function() {
|
||||
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
||||
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
|
||||
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
|
||||
var str = JSON.stringify({
|
||||
const outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
||||
const inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
|
||||
const inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
|
||||
const str = JSON.stringify({
|
||||
type: 'Polygon',
|
||||
coordinates: [outer, inner1, inner2]
|
||||
});
|
||||
|
||||
var obj = format.readGeometry(str);
|
||||
const obj = format.readGeometry(str);
|
||||
expect(obj).to.be.a(Polygon);
|
||||
expect(obj.getLayout()).to.eql('XY');
|
||||
var rings = obj.getLinearRings();
|
||||
const rings = obj.getLinearRings();
|
||||
expect(rings.length).to.be(3);
|
||||
expect(rings[0]).to.be.a(LinearRing);
|
||||
expect(rings[1]).to.be.a(LinearRing);
|
||||
@@ -405,7 +405,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('parses geometry collection', function() {
|
||||
var str = JSON.stringify({
|
||||
const str = JSON.stringify({
|
||||
type: 'GeometryCollection',
|
||||
geometries: [
|
||||
{type: 'Point', coordinates: [10, 20]},
|
||||
@@ -413,9 +413,9 @@ describe('ol.format.GeoJSON', function() {
|
||||
]
|
||||
});
|
||||
|
||||
var geometryCollection = format.readGeometry(str);
|
||||
const geometryCollection = format.readGeometry(str);
|
||||
expect(geometryCollection).to.be.an(GeometryCollection);
|
||||
var array = geometryCollection.getGeometries();
|
||||
const array = geometryCollection.getGeometries();
|
||||
expect(array.length).to.be(2);
|
||||
expect(array[0]).to.be.a(Point);
|
||||
expect(array[0].getLayout()).to.eql('XY');
|
||||
@@ -429,7 +429,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('reads named crs from top-level object', function() {
|
||||
|
||||
var json = {
|
||||
const json = {
|
||||
type: 'FeatureCollection',
|
||||
crs: {
|
||||
type: 'name',
|
||||
@@ -457,16 +457,16 @@ describe('ol.format.GeoJSON', function() {
|
||||
}
|
||||
}]
|
||||
};
|
||||
var features = format.readFeatures(json);
|
||||
const features = format.readFeatures(json);
|
||||
|
||||
expect(features.length).to.be(2);
|
||||
|
||||
var first = features[0];
|
||||
const first = features[0];
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('foo')).to.be('bar');
|
||||
expect(first.getGeometry()).to.be.a(Point);
|
||||
|
||||
var second = features[1];
|
||||
const second = features[1];
|
||||
expect(second).to.be.a(Feature);
|
||||
expect(second.get('bam')).to.be('baz');
|
||||
expect(second.getGeometry()).to.be.a(LineString);
|
||||
@@ -477,7 +477,7 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('accepts null crs', function() {
|
||||
|
||||
var json = {
|
||||
const json = {
|
||||
type: 'FeatureCollection',
|
||||
crs: null,
|
||||
features: [{
|
||||
@@ -500,16 +500,16 @@ describe('ol.format.GeoJSON', function() {
|
||||
}
|
||||
}]
|
||||
};
|
||||
var features = format.readFeatures(json);
|
||||
const features = format.readFeatures(json);
|
||||
|
||||
expect(features.length).to.be(2);
|
||||
|
||||
var first = features[0];
|
||||
const first = features[0];
|
||||
expect(first).to.be.a(Feature);
|
||||
expect(first.get('foo')).to.be('bar');
|
||||
expect(first.getGeometry()).to.be.a(Point);
|
||||
|
||||
var second = features[1];
|
||||
const second = features[1];
|
||||
expect(second).to.be.a(Feature);
|
||||
expect(second.get('bam')).to.be('baz');
|
||||
expect(second.getGeometry()).to.be.a(LineString);
|
||||
@@ -523,17 +523,17 @@ describe('ol.format.GeoJSON', function() {
|
||||
describe('#writeFeatures', function() {
|
||||
|
||||
it('encodes feature collection', function() {
|
||||
var str = JSON.stringify(data);
|
||||
var array = format.readFeatures(str);
|
||||
var geojson = format.writeFeaturesObject(array);
|
||||
var result = format.readFeatures(geojson);
|
||||
const str = JSON.stringify(data);
|
||||
const array = format.readFeatures(str);
|
||||
const geojson = format.writeFeaturesObject(array);
|
||||
const result = format.readFeatures(geojson);
|
||||
expect(array.length).to.equal(result.length);
|
||||
var got, exp, gotProp, expProp;
|
||||
for (var i = 0, ii = array.length; i < ii; ++i) {
|
||||
let got, exp, gotProp, expProp;
|
||||
for (let i = 0, ii = array.length; i < ii; ++i) {
|
||||
got = array[i];
|
||||
exp = result[i];
|
||||
expect(got.getGeometry().getCoordinates()).to.eql(
|
||||
exp.getGeometry().getCoordinates());
|
||||
exp.getGeometry().getCoordinates());
|
||||
gotProp = got.getProperties();
|
||||
delete gotProp.geometry;
|
||||
expProp = exp.getProperties();
|
||||
@@ -543,46 +543,46 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('transforms and encodes feature collection', function() {
|
||||
var str = JSON.stringify(data);
|
||||
var array = format.readFeatures(str);
|
||||
var geojson = format.writeFeatures(array, {
|
||||
const str = JSON.stringify(data);
|
||||
const array = format.readFeatures(str);
|
||||
const geojson = format.writeFeatures(array, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
var result = format.readFeatures(geojson);
|
||||
var got, exp;
|
||||
for (var i = 0, ii = array.length; i < ii; ++i) {
|
||||
const result = format.readFeatures(geojson);
|
||||
let got, exp;
|
||||
for (let i = 0, ii = array.length; i < ii; ++i) {
|
||||
got = array[i];
|
||||
exp = result[i];
|
||||
expect(got.getGeometry().transform('EPSG:3857', 'EPSG:4326')
|
||||
.getCoordinates()).to.eql(exp.getGeometry().getCoordinates());
|
||||
.getCoordinates()).to.eql(exp.getGeometry().getCoordinates());
|
||||
}
|
||||
});
|
||||
|
||||
it('writes out a feature with a different geometryName correctly',
|
||||
function() {
|
||||
var feature = new Feature({'foo': 'bar'});
|
||||
feature.setGeometryName('mygeom');
|
||||
feature.setGeometry(new Point([5, 10]));
|
||||
var geojson = format.writeFeaturesObject([feature]);
|
||||
expect(geojson.features[0].properties.mygeom).to.eql(undefined);
|
||||
});
|
||||
function() {
|
||||
const feature = new Feature({'foo': 'bar'});
|
||||
feature.setGeometryName('mygeom');
|
||||
feature.setGeometry(new Point([5, 10]));
|
||||
const geojson = format.writeFeaturesObject([feature]);
|
||||
expect(geojson.features[0].properties.mygeom).to.eql(undefined);
|
||||
});
|
||||
|
||||
it('writes out a feature without properties correctly', function() {
|
||||
var feature = new Feature(new Point([5, 10]));
|
||||
var geojson = format.writeFeatureObject(feature);
|
||||
const feature = new Feature(new Point([5, 10]));
|
||||
const geojson = format.writeFeatureObject(feature);
|
||||
expect(geojson.properties).to.eql(null);
|
||||
});
|
||||
|
||||
it('writes out a feature without geometry correctly', function() {
|
||||
var feature = new Feature();
|
||||
var geojson = format.writeFeatureObject(feature);
|
||||
const feature = new Feature();
|
||||
const geojson = format.writeFeatureObject(feature);
|
||||
expect(geojson.geometry).to.eql(null);
|
||||
});
|
||||
|
||||
it('writes out a feature with id equal to 0 correctly', function() {
|
||||
var feature = new Feature();
|
||||
const feature = new Feature();
|
||||
feature.setId(0);
|
||||
var geojson = format.writeFeatureObject(feature);
|
||||
const geojson = format.writeFeatureObject(feature);
|
||||
expect(geojson.id).to.eql(0);
|
||||
});
|
||||
});
|
||||
@@ -590,77 +590,77 @@ describe('ol.format.GeoJSON', function() {
|
||||
describe('#writeGeometry', function() {
|
||||
|
||||
it('encodes point', function() {
|
||||
var point = new Point([10, 20]);
|
||||
var geojson = format.writeGeometry(point);
|
||||
const point = new Point([10, 20]);
|
||||
const geojson = format.writeGeometry(point);
|
||||
expect(point.getCoordinates()).to.eql(
|
||||
format.readGeometry(geojson).getCoordinates());
|
||||
format.readGeometry(geojson).getCoordinates());
|
||||
});
|
||||
|
||||
it('accepts featureProjection', function() {
|
||||
var point = new Point(fromLonLat([10, 20]));
|
||||
var geojson = format.writeGeometry(point, {featureProjection: 'EPSG:3857'});
|
||||
var obj = JSON.parse(geojson);
|
||||
const point = new Point(fromLonLat([10, 20]));
|
||||
const geojson = format.writeGeometry(point, {featureProjection: 'EPSG:3857'});
|
||||
const obj = JSON.parse(geojson);
|
||||
expect(obj.coordinates).to.eql(toLonLat(point.getCoordinates()));
|
||||
});
|
||||
|
||||
it('respects featureProjection passed to constructor', function() {
|
||||
var format = new GeoJSON({featureProjection: 'EPSG:3857'});
|
||||
var point = new Point(fromLonLat([10, 20]));
|
||||
var geojson = format.writeGeometry(point);
|
||||
var obj = JSON.parse(geojson);
|
||||
const format = new GeoJSON({featureProjection: 'EPSG:3857'});
|
||||
const point = new Point(fromLonLat([10, 20]));
|
||||
const geojson = format.writeGeometry(point);
|
||||
const obj = JSON.parse(geojson);
|
||||
expect(obj.coordinates).to.eql(toLonLat(point.getCoordinates()));
|
||||
});
|
||||
|
||||
it('encodes linestring', function() {
|
||||
var linestring = new LineString([[10, 20], [30, 40]]);
|
||||
var geojson = format.writeGeometry(linestring);
|
||||
const linestring = new LineString([[10, 20], [30, 40]]);
|
||||
const geojson = format.writeGeometry(linestring);
|
||||
expect(linestring.getCoordinates()).to.eql(
|
||||
format.readGeometry(geojson).getCoordinates());
|
||||
format.readGeometry(geojson).getCoordinates());
|
||||
});
|
||||
|
||||
it('encodes polygon', function() {
|
||||
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
||||
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
|
||||
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
|
||||
var polygon = new Polygon([outer, inner1, inner2]);
|
||||
var geojson = format.writeGeometry(polygon);
|
||||
const outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
|
||||
const inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
|
||||
const inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
|
||||
const polygon = new Polygon([outer, inner1, inner2]);
|
||||
const geojson = format.writeGeometry(polygon);
|
||||
expect(polygon.getCoordinates()).to.eql(
|
||||
format.readGeometry(geojson).getCoordinates());
|
||||
format.readGeometry(geojson).getCoordinates());
|
||||
});
|
||||
|
||||
it('maintains coordinate order by default', function() {
|
||||
|
||||
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||
const cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||
const ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||
|
||||
var right = new Polygon([ccw, cw]);
|
||||
var rightMulti = new MultiPolygon([[ccw, cw]]);
|
||||
var left = new Polygon([cw, ccw]);
|
||||
var leftMulti = new MultiPolygon([[cw, ccw]]);
|
||||
const right = new Polygon([ccw, cw]);
|
||||
const rightMulti = new MultiPolygon([[ccw, cw]]);
|
||||
const left = new Polygon([cw, ccw]);
|
||||
const leftMulti = new MultiPolygon([[cw, ccw]]);
|
||||
|
||||
var rightObj = {
|
||||
const rightObj = {
|
||||
type: 'Polygon',
|
||||
coordinates: [ccw, cw]
|
||||
};
|
||||
|
||||
var rightMultiObj = {
|
||||
const rightMultiObj = {
|
||||
type: 'MultiPolygon',
|
||||
coordinates: [[ccw, cw]]
|
||||
};
|
||||
|
||||
var leftObj = {
|
||||
const leftObj = {
|
||||
type: 'Polygon',
|
||||
coordinates: [cw, ccw]
|
||||
};
|
||||
|
||||
var leftMultiObj = {
|
||||
const leftMultiObj = {
|
||||
type: 'MultiPolygon',
|
||||
coordinates: [[cw, ccw]]
|
||||
};
|
||||
|
||||
expect(JSON.parse(format.writeGeometry(right))).to.eql(rightObj);
|
||||
expect(
|
||||
JSON.parse(format.writeGeometry(rightMulti))).to.eql(rightMultiObj);
|
||||
JSON.parse(format.writeGeometry(rightMulti))).to.eql(rightMultiObj);
|
||||
expect(JSON.parse(format.writeGeometry(left))).to.eql(leftObj);
|
||||
expect(JSON.parse(format.writeGeometry(leftMulti))).to.eql(leftMultiObj);
|
||||
|
||||
@@ -668,24 +668,24 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('allows serializing following the right-hand rule', function() {
|
||||
|
||||
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||
var right = new Polygon([ccw, cw]);
|
||||
var rightMulti = new MultiPolygon([[ccw, cw]]);
|
||||
var left = new Polygon([cw, ccw]);
|
||||
var leftMulti = new MultiPolygon([[cw, ccw]]);
|
||||
const cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||
const ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||
const right = new Polygon([ccw, cw]);
|
||||
const rightMulti = new MultiPolygon([[ccw, cw]]);
|
||||
const left = new Polygon([cw, ccw]);
|
||||
const leftMulti = new MultiPolygon([[cw, ccw]]);
|
||||
|
||||
var rightObj = {
|
||||
const rightObj = {
|
||||
type: 'Polygon',
|
||||
coordinates: [ccw, cw]
|
||||
};
|
||||
|
||||
var rightMultiObj = {
|
||||
const rightMultiObj = {
|
||||
type: 'MultiPolygon',
|
||||
coordinates: [[ccw, cw]]
|
||||
};
|
||||
|
||||
var json = format.writeGeometry(right, {rightHanded: true});
|
||||
let json = format.writeGeometry(right, {rightHanded: true});
|
||||
expect(JSON.parse(json)).to.eql(rightObj);
|
||||
json = format.writeGeometry(rightMulti, {rightHanded: true});
|
||||
expect(JSON.parse(json)).to.eql(rightMultiObj);
|
||||
@@ -699,24 +699,24 @@ describe('ol.format.GeoJSON', function() {
|
||||
|
||||
it('allows serializing following the left-hand rule', function() {
|
||||
|
||||
var cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||
var ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||
var right = new Polygon([ccw, cw]);
|
||||
var rightMulti = new MultiPolygon([[ccw, cw]]);
|
||||
var left = new Polygon([cw, ccw]);
|
||||
var leftMulti = new MultiPolygon([[cw, ccw]]);
|
||||
const cw = [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]];
|
||||
const ccw = [[-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90]];
|
||||
const right = new Polygon([ccw, cw]);
|
||||
const rightMulti = new MultiPolygon([[ccw, cw]]);
|
||||
const left = new Polygon([cw, ccw]);
|
||||
const leftMulti = new MultiPolygon([[cw, ccw]]);
|
||||
|
||||
var leftObj = {
|
||||
const leftObj = {
|
||||
type: 'Polygon',
|
||||
coordinates: [cw, ccw]
|
||||
};
|
||||
|
||||
var leftMultiObj = {
|
||||
const leftMultiObj = {
|
||||
type: 'MultiPolygon',
|
||||
coordinates: [[cw, ccw]]
|
||||
};
|
||||
|
||||
var json = format.writeGeometry(right, {rightHanded: false});
|
||||
let json = format.writeGeometry(right, {rightHanded: false});
|
||||
expect(JSON.parse(json)).to.eql(leftObj);
|
||||
json = format.writeGeometry(rightMulti, {rightHanded: false});
|
||||
expect(JSON.parse(json)).to.eql(leftMultiObj);
|
||||
@@ -729,26 +729,26 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('encodes geometry collection', function() {
|
||||
var collection = new GeometryCollection([
|
||||
const collection = new GeometryCollection([
|
||||
new Point([10, 20]),
|
||||
new LineString([[30, 40], [50, 60]])
|
||||
]);
|
||||
var geojson = format.writeGeometry(collection);
|
||||
var got = format.readGeometry(geojson);
|
||||
const geojson = format.writeGeometry(collection);
|
||||
const got = format.readGeometry(geojson);
|
||||
expect(got).to.be.an(GeometryCollection);
|
||||
var gotGeometries = got.getGeometries();
|
||||
var geometries = collection.getGeometries();
|
||||
const gotGeometries = got.getGeometries();
|
||||
const geometries = collection.getGeometries();
|
||||
expect(geometries.length).to.equal(gotGeometries.length);
|
||||
for (var i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
for (let i = 0, ii = geometries.length; i < ii; ++i) {
|
||||
expect(geometries[i].getCoordinates()).
|
||||
to.eql(gotGeometries[i].getCoordinates());
|
||||
to.eql(gotGeometries[i].getCoordinates());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
it('encodes a circle as an empty geometry collection', function() {
|
||||
var circle = new Circle([0, 0], 1);
|
||||
var geojson = format.writeGeometryObject(circle);
|
||||
const circle = new Circle([0, 0], 1);
|
||||
const geojson = format.writeGeometryObject(circle);
|
||||
expect(geojson).to.eql({
|
||||
'type': 'GeometryCollection',
|
||||
'geometries': []
|
||||
@@ -756,74 +756,74 @@ describe('ol.format.GeoJSON', function() {
|
||||
});
|
||||
|
||||
it('transforms and encodes a point', function() {
|
||||
var point = new Point([2, 3]);
|
||||
var geojson = format.writeGeometry(point, {
|
||||
const point = new Point([2, 3]);
|
||||
const geojson = format.writeGeometry(point, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
var newPoint = format.readGeometry(geojson, {
|
||||
const newPoint = format.readGeometry(geojson, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(point.getCoordinates()[0]).to.roughlyEqual(
|
||||
newPoint.getCoordinates()[0], 1e-8);
|
||||
newPoint.getCoordinates()[0], 1e-8);
|
||||
expect(point.getCoordinates()[1]).to.roughlyEqual(
|
||||
newPoint.getCoordinates()[1], 1e-8);
|
||||
newPoint.getCoordinates()[1], 1e-8);
|
||||
});
|
||||
|
||||
it('transforms and encodes geometry collection', function() {
|
||||
var collection = new GeometryCollection([
|
||||
const collection = new GeometryCollection([
|
||||
new Point([2, 3]),
|
||||
new LineString([[3, 2], [2, 1]])
|
||||
]);
|
||||
var geojson = format.writeGeometry(collection, {
|
||||
const geojson = format.writeGeometry(collection, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
var got = format.readGeometry(geojson, {
|
||||
const got = format.readGeometry(geojson, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
var gotGeometries = got.getGeometries();
|
||||
var geometries = collection.getGeometries();
|
||||
const gotGeometries = got.getGeometries();
|
||||
const geometries = collection.getGeometries();
|
||||
expect(geometries[0].getCoordinates()[0]).to.roughlyEqual(
|
||||
gotGeometries[0].getCoordinates()[0], 1e-8);
|
||||
gotGeometries[0].getCoordinates()[0], 1e-8);
|
||||
expect(geometries[0].getCoordinates()[1]).to.roughlyEqual(
|
||||
gotGeometries[0].getCoordinates()[1], 1e-8);
|
||||
gotGeometries[0].getCoordinates()[1], 1e-8);
|
||||
expect(geometries[1].getCoordinates()[0][0]).to.roughlyEqual(
|
||||
gotGeometries[1].getCoordinates()[0][0], 1e-8);
|
||||
gotGeometries[1].getCoordinates()[0][0], 1e-8);
|
||||
expect(geometries[1].getCoordinates()[0][1]).to.roughlyEqual(
|
||||
gotGeometries[1].getCoordinates()[0][1], 1e-8);
|
||||
gotGeometries[1].getCoordinates()[0][1], 1e-8);
|
||||
});
|
||||
|
||||
it('truncates transformed point with decimals option', function() {
|
||||
var point = new Point([2, 3]).transform('EPSG:4326', 'EPSG:3857');
|
||||
var geojson = format.writeGeometry(point, {
|
||||
const point = new Point([2, 3]).transform('EPSG:4326', 'EPSG:3857');
|
||||
const geojson = format.writeGeometry(point, {
|
||||
featureProjection: 'EPSG:3857',
|
||||
decimals: 2
|
||||
});
|
||||
expect(format.readGeometry(geojson).getCoordinates()).to.eql(
|
||||
[2, 3]);
|
||||
[2, 3]);
|
||||
});
|
||||
|
||||
it('truncates a linestring with decimals option', function() {
|
||||
var linestring = new LineString([[42.123456789, 38.987654321],
|
||||
const linestring = new LineString([[42.123456789, 38.987654321],
|
||||
[43, 39]]);
|
||||
var geojson = format.writeGeometry(linestring, {
|
||||
const geojson = format.writeGeometry(linestring, {
|
||||
decimals: 6
|
||||
});
|
||||
expect(format.readGeometry(geojson).getCoordinates()).to.eql(
|
||||
[[42.123457, 38.987654], [43, 39]]);
|
||||
[[42.123457, 38.987654], [43, 39]]);
|
||||
expect(linestring.getCoordinates()).to.eql(
|
||||
[[42.123456789, 38.987654321], [43, 39]]);
|
||||
[[42.123456789, 38.987654321], [43, 39]]);
|
||||
});
|
||||
|
||||
it('rounds a linestring with decimals option = 0', function() {
|
||||
var linestring = new LineString([[42.123456789, 38.987654321],
|
||||
const linestring = new LineString([[42.123456789, 38.987654321],
|
||||
[43, 39]]);
|
||||
var geojson = format.writeGeometry(linestring, {
|
||||
const geojson = format.writeGeometry(linestring, {
|
||||
decimals: 0
|
||||
});
|
||||
expect(format.readGeometry(geojson).getCoordinates()).to.eql(
|
||||
[[42, 39], [43, 39]]);
|
||||
[[42, 39], [43, 39]]);
|
||||
expect(linestring.getCoordinates()).to.eql(
|
||||
[[42.123456789, 38.987654321], [43, 39]]);
|
||||
[[42.123456789, 38.987654321], [43, 39]]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+198
-198
File diff suppressed because it is too large
Load Diff
+112
-112
@@ -9,19 +9,19 @@ import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
|
||||
describe('ol.format.GPX', function() {
|
||||
|
||||
var format;
|
||||
let format;
|
||||
beforeEach(function() {
|
||||
format = new GPX();
|
||||
});
|
||||
|
||||
describe('#readProjection', function() {
|
||||
it('returns the default projection from document', function() {
|
||||
var projection = format.readProjectionFromDocument();
|
||||
const projection = format.readProjectionFromDocument();
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
|
||||
it('returns the default projection from node', function() {
|
||||
var projection = format.readProjectionFromNode();
|
||||
const projection = format.readProjectionFromNode();
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
@@ -29,22 +29,22 @@ describe('ol.format.GPX', function() {
|
||||
describe('rte', function() {
|
||||
|
||||
it('can read an empty rte', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1">' +
|
||||
' <rte/>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
expect(g.getCoordinates()).to.eql([]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
});
|
||||
|
||||
it('can read and write various rte attributes', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -62,9 +62,9 @@ describe('ol.format.GPX', function() {
|
||||
' <type>Type</type>' +
|
||||
' </rte>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('name')).to.be('Name');
|
||||
expect(f.get('cmt')).to.be('Comment');
|
||||
@@ -75,12 +75,12 @@ describe('ol.format.GPX', function() {
|
||||
expect(f.get('linkType')).to.be('Link type');
|
||||
expect(f.get('number')).to.be(1);
|
||||
expect(f.get('type')).to.be('Type');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a rte with multiple rtepts', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -90,20 +90,20 @@ describe('ol.format.GPX', function() {
|
||||
' <rtept lat="3" lon="4"/>' +
|
||||
' </rte>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can transform, read and write a rte', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -113,26 +113,26 @@ describe('ol.format.GPX', function() {
|
||||
' <rtept lat="5" lon="6"/>' +
|
||||
' </rte>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text, {
|
||||
const fs = format.readFeatures(text, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
var p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
var p2 = transform([6, 5], 'EPSG:4326', 'EPSG:3857');
|
||||
const p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
const p2 = transform([6, 5], 'EPSG:4326', 'EPSG:3857');
|
||||
expect(g.getCoordinates()).to.eql([p1, p2]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs, {
|
||||
const serialized = format.writeFeaturesNode(fs, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('does not write rte attributes in rtepts', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -143,8 +143,8 @@ describe('ol.format.GPX', function() {
|
||||
' <rtept lat="3" lon="4"/>' +
|
||||
' </rte>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const fs = format.readFeatures(text);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
@@ -153,22 +153,22 @@ describe('ol.format.GPX', function() {
|
||||
describe('trk', function() {
|
||||
|
||||
it('can read an empty trk', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1">' +
|
||||
' <trk/>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
expect(g.getCoordinates()).to.eql([]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
});
|
||||
|
||||
it('can read and write various trk attributes', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -186,9 +186,9 @@ describe('ol.format.GPX', function() {
|
||||
' <type>Type</type>' +
|
||||
' </trk>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('name')).to.be('Name');
|
||||
expect(f.get('cmt')).to.be('Comment');
|
||||
@@ -199,12 +199,12 @@ describe('ol.format.GPX', function() {
|
||||
expect(f.get('linkType')).to.be('Link type');
|
||||
expect(f.get('number')).to.be(1);
|
||||
expect(f.get('type')).to.be('Type');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a trk with an empty trkseg', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -213,20 +213,20 @@ describe('ol.format.GPX', function() {
|
||||
' <trkseg/>' +
|
||||
' </trk>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
expect(g.getCoordinates()).to.eql([[]]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read/write a trk with a trkseg with multiple trkpts', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -244,22 +244,22 @@ describe('ol.format.GPX', function() {
|
||||
' </trkseg>' +
|
||||
' </trk>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[2, 1, 3, 1263115752], [6, 5, 7, 1263115812]]
|
||||
]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can transform, read and write a trk with a trkseg', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -277,28 +277,28 @@ describe('ol.format.GPX', function() {
|
||||
' </trkseg>' +
|
||||
' </trk>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text, {
|
||||
const fs = format.readFeatures(text, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
var p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
const p1 = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
p1.push(3, 1263115752);
|
||||
var p2 = transform([6, 5], 'EPSG:4326', 'EPSG:3857');
|
||||
const p2 = transform([6, 5], 'EPSG:4326', 'EPSG:3857');
|
||||
p2.push(7, 1263115812);
|
||||
expect(g.getCoordinates()).to.eql([[p1, p2]]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
var serialized = format.writeFeaturesNode(fs, {
|
||||
const serialized = format.writeFeaturesNode(fs, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a trk with multiple trksegs', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -326,23 +326,23 @@ describe('ol.format.GPX', function() {
|
||||
' </trkseg>' +
|
||||
' </trk>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(MultiLineString);
|
||||
expect(g.getCoordinates()).to.eql([
|
||||
[[2, 1, 3, 1263115752], [6, 5, 7, 1263115812]],
|
||||
[[9, 8, 10, 1263115872], [12, 11, 13, 1263115932]]
|
||||
]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('does not write trk attributes in trkpts', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -371,8 +371,8 @@ describe('ol.format.GPX', function() {
|
||||
' </trkseg>' +
|
||||
' </trk>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const fs = format.readFeatures(text);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
@@ -381,52 +381,52 @@ describe('ol.format.GPX', function() {
|
||||
describe('wpt', function() {
|
||||
|
||||
it('can read and write a wpt', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
'http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="OpenLayers">' +
|
||||
' <wpt lat="1" lon="2"/>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1]);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can transform, read and write a wpt', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
'http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" creator="OpenLayers">' +
|
||||
' <wpt lat="1" lon="2"/>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text, {
|
||||
const fs = format.readFeatures(text, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
var expectedPoint = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
const expectedPoint = transform([2, 1], 'EPSG:4326', 'EPSG:3857');
|
||||
expect(g.getCoordinates()).to.eql(expectedPoint);
|
||||
expect(g.getLayout()).to.be('XY');
|
||||
var serialized = format.writeFeaturesNode(fs, {
|
||||
const serialized = format.writeFeaturesNode(fs, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a wpt with ele', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -435,20 +435,20 @@ describe('ol.format.GPX', function() {
|
||||
' <ele>3</ele>' +
|
||||
' </wpt>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 3]);
|
||||
expect(g.getLayout()).to.be('XYZ');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a wpt with time', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -457,20 +457,20 @@ describe('ol.format.GPX', function() {
|
||||
' <time>2010-01-10T09:29:12Z</time>' +
|
||||
' </wpt>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 1263115752]);
|
||||
expect(g.getLayout()).to.be('XYM');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write a wpt with ele and time', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -480,20 +480,20 @@ describe('ol.format.GPX', function() {
|
||||
' <time>2010-01-10T09:29:12Z</time>' +
|
||||
' </wpt>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1, 3, 1263115752]);
|
||||
expect(g.getLayout()).to.be('XYZM');
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('can read and write various wpt attributes', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
@@ -520,9 +520,9 @@ describe('ol.format.GPX', function() {
|
||||
' <dgpsid>10</dgpsid>' +
|
||||
' </wpt>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
expect(f.get('magvar')).to.be(11);
|
||||
expect(f.get('geoidheight')).to.be(4);
|
||||
@@ -541,7 +541,7 @@ describe('ol.format.GPX', function() {
|
||||
expect(f.get('pdop')).to.be(8);
|
||||
expect(f.get('ageofdgpsdata')).to.be(9);
|
||||
expect(f.get('dgpsid')).to.be(10);
|
||||
var serialized = format.writeFeaturesNode(fs);
|
||||
const serialized = format.writeFeaturesNode(fs);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
@@ -554,35 +554,35 @@ describe('ol.format.GPX', function() {
|
||||
});
|
||||
|
||||
it('can read features with a version 1.0 namespace', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/0">' +
|
||||
' <wpt/>' +
|
||||
' <rte/>' +
|
||||
' <trk/>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(3);
|
||||
});
|
||||
|
||||
it('can read features with a version 1.1 namespace', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1">' +
|
||||
' <wpt/>' +
|
||||
' <rte/>' +
|
||||
' <trk/>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(3);
|
||||
});
|
||||
|
||||
it('can read features with no namespace', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx>' +
|
||||
' <wpt/>' +
|
||||
' <rte/>' +
|
||||
' <trk/>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(3);
|
||||
});
|
||||
|
||||
@@ -593,15 +593,15 @@ describe('ol.format.GPX', function() {
|
||||
beforeEach(function() {
|
||||
format = new GPX({
|
||||
readExtensions: function(feature, extensionsNode) {
|
||||
var nodes = extensionsNode.getElementsByTagName('id');
|
||||
var id = nodes.item(0).textContent;
|
||||
const nodes = extensionsNode.getElementsByTagName('id');
|
||||
const id = nodes.item(0).textContent;
|
||||
feature.setId(id);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('can process extensions from wpt', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1">' +
|
||||
' <wpt>' +
|
||||
' <extensions>' +
|
||||
@@ -609,14 +609,14 @@ describe('ol.format.GPX', function() {
|
||||
' </extensions>' +
|
||||
' </wpt>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var feature = fs[0];
|
||||
const feature = fs[0];
|
||||
expect(feature.getId()).to.be('feature-id');
|
||||
});
|
||||
|
||||
it('can process extensions from rte', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1">' +
|
||||
' <rte>' +
|
||||
' <extensions>' +
|
||||
@@ -625,14 +625,14 @@ describe('ol.format.GPX', function() {
|
||||
' </extensions>' +
|
||||
' </rte>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var feature = fs[0];
|
||||
const feature = fs[0];
|
||||
expect(feature.getId()).to.be('feature-id');
|
||||
});
|
||||
|
||||
it('can process extensions from trk, not trkpt', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1">' +
|
||||
' <trk>' +
|
||||
' <extensions>' +
|
||||
@@ -647,9 +647,9 @@ describe('ol.format.GPX', function() {
|
||||
' </trkseg>' +
|
||||
' </trk>' +
|
||||
'</gpx>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(1);
|
||||
var feature = fs[0];
|
||||
const feature = fs[0];
|
||||
expect(feature.getId()).to.be('feature-id');
|
||||
});
|
||||
|
||||
@@ -661,12 +661,12 @@ describe('ol.format.GPX', function() {
|
||||
});
|
||||
|
||||
it('does not fail', function() {
|
||||
var polygon = new Polygon(
|
||||
[[[0, 0], [2, 2], [4, 0], [0, 0]]]);
|
||||
var feature = new Feature(polygon);
|
||||
var features = [feature];
|
||||
var gpx = format.writeFeaturesNode(features);
|
||||
var expected =
|
||||
const polygon = new Polygon(
|
||||
[[[0, 0], [2, 2], [4, 0], [0, 0]]]);
|
||||
const feature = new Feature(polygon);
|
||||
const features = [feature];
|
||||
const gpx = format.writeFeaturesNode(features);
|
||||
const expected =
|
||||
'<gpx xmlns="http://www.topografix.com/GPX/1/1" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
|
||||
|
||||
@@ -5,8 +5,8 @@ import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
describe('ol.format.IGC', function() {
|
||||
|
||||
var format;
|
||||
var igc =
|
||||
let format;
|
||||
const igc =
|
||||
'AFLY05094\n' +
|
||||
'HFDTE190411\n' +
|
||||
'HFFXA100\n' +
|
||||
@@ -34,7 +34,7 @@ describe('ol.format.IGC', function() {
|
||||
|
||||
describe('#readProjectionFromText', function() {
|
||||
it('returns the default projection', function() {
|
||||
var projection = format.readProjectionFromText(igc);
|
||||
const projection = format.readProjectionFromText(igc);
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
@@ -45,9 +45,9 @@ describe('ol.format.IGC', function() {
|
||||
});
|
||||
|
||||
it('does read a feature', function() {
|
||||
var feature = format.readFeature(igc);
|
||||
const feature = format.readFeature(igc);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geom = feature.getGeometry();
|
||||
const geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
expect(geom.getCoordinates()).to.eql([
|
||||
[6.851583333333333, 45.9376, 1303202928],
|
||||
@@ -57,28 +57,28 @@ describe('ol.format.IGC', function() {
|
||||
});
|
||||
|
||||
it('does transform and read a feature', function() {
|
||||
var feature = format.readFeature(igc, {
|
||||
const feature = format.readFeature(igc, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geom = feature.getGeometry();
|
||||
const geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
|
||||
var expectedPoint1 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
const expectedPoint1 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint1.push(1303202928);
|
||||
var expectedPoint2 = transform(
|
||||
[6.850183333333334, 45.93395], 'EPSG:4326', 'EPSG:3857');
|
||||
const expectedPoint2 = transform(
|
||||
[6.850183333333334, 45.93395], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint2.push(1303203353);
|
||||
var expectedPoint3 = transform(
|
||||
[6.800816666666667, 45.916066666666666], 'EPSG:4326', 'EPSG:3857');
|
||||
const expectedPoint3 = transform(
|
||||
[6.800816666666667, 45.916066666666666], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint3.push(1303203815);
|
||||
var expectedPoint4 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
const expectedPoint4 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint4.push(1303289328);
|
||||
|
||||
expect(geom.getCoordinates()).to.eql(
|
||||
[expectedPoint1, expectedPoint2, expectedPoint3, expectedPoint4]);
|
||||
[expectedPoint1, expectedPoint2, expectedPoint3, expectedPoint4]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -90,11 +90,11 @@ describe('ol.format.IGC', function() {
|
||||
});
|
||||
|
||||
it('does read features', function() {
|
||||
var features = format.readFeatures(igc);
|
||||
const features = format.readFeatures(igc);
|
||||
expect(features.length).to.eql(1);
|
||||
var feature = features[0];
|
||||
const feature = features[0];
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geom = feature.getGeometry();
|
||||
const geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
expect(geom.getCoordinates()).to.eql([
|
||||
[6.851583333333333, 45.9376, 1303202928],
|
||||
@@ -104,30 +104,30 @@ describe('ol.format.IGC', function() {
|
||||
});
|
||||
|
||||
it('does transform and read features', function() {
|
||||
var features = format.readFeatures(igc, {
|
||||
const features = format.readFeatures(igc, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(features.length).to.eql(1);
|
||||
var feature = features[0];
|
||||
const feature = features[0];
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geom = feature.getGeometry();
|
||||
const geom = feature.getGeometry();
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
|
||||
var expectedPoint1 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
const expectedPoint1 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint1.push(1303202928);
|
||||
var expectedPoint2 = transform(
|
||||
[6.850183333333334, 45.93395], 'EPSG:4326', 'EPSG:3857');
|
||||
const expectedPoint2 = transform(
|
||||
[6.850183333333334, 45.93395], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint2.push(1303203353);
|
||||
var expectedPoint3 = transform(
|
||||
[6.800816666666667, 45.916066666666666], 'EPSG:4326', 'EPSG:3857');
|
||||
const expectedPoint3 = transform(
|
||||
[6.800816666666667, 45.916066666666666], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint3.push(1303203815);
|
||||
var expectedPoint4 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
const expectedPoint4 = transform(
|
||||
[6.851583333333333, 45.9376], 'EPSG:4326', 'EPSG:3857');
|
||||
expectedPoint4.push(1303289328);
|
||||
|
||||
expect(geom.getCoordinates()).to.eql(
|
||||
[expectedPoint1, expectedPoint2, expectedPoint3, expectedPoint4]);
|
||||
[expectedPoint1, expectedPoint2, expectedPoint3, expectedPoint4]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+584
-584
File diff suppressed because it is too large
Load Diff
@@ -8,9 +8,9 @@ import RenderFeature from '../../../../src/ol/render/Feature.js';
|
||||
|
||||
where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
|
||||
|
||||
var data;
|
||||
let data;
|
||||
beforeEach(function(done) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'spec/ol/data/14-8938-5680.vector.pbf');
|
||||
xhr.responseType = 'arraybuffer';
|
||||
xhr.onload = function() {
|
||||
@@ -23,23 +23,23 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
|
||||
describe('#readFeatures', function() {
|
||||
|
||||
it('uses ol.render.Feature as feature class by default', function() {
|
||||
var format = new MVT({layers: ['water']});
|
||||
var features = format.readFeatures(data);
|
||||
const format = new MVT({layers: ['water']});
|
||||
const features = format.readFeatures(data);
|
||||
expect(features[0]).to.be.a(RenderFeature);
|
||||
});
|
||||
|
||||
it('parses only specified layers', function() {
|
||||
var format = new MVT({layers: ['water']});
|
||||
var features = format.readFeatures(data);
|
||||
const format = new MVT({layers: ['water']});
|
||||
const features = format.readFeatures(data);
|
||||
expect(features.length).to.be(10);
|
||||
});
|
||||
|
||||
it('parses geometries correctly', function() {
|
||||
var format = new MVT({
|
||||
const format = new MVT({
|
||||
featureClass: Feature,
|
||||
layers: ['poi_label']
|
||||
});
|
||||
var geometry;
|
||||
let geometry;
|
||||
|
||||
geometry = format.readFeatures(data)[0].getGeometry();
|
||||
expect(geometry.getType()).to.be('Point');
|
||||
@@ -60,11 +60,11 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
|
||||
|
||||
it('parses id property', function() {
|
||||
// ol.Feature
|
||||
var format = new MVT({
|
||||
let format = new MVT({
|
||||
featureClass: Feature,
|
||||
layers: ['building']
|
||||
});
|
||||
var features = format.readFeatures(data);
|
||||
let features = format.readFeatures(data);
|
||||
expect(features[0].getId()).to.be(2);
|
||||
// ol.render.Feature
|
||||
format = new MVT({
|
||||
@@ -75,9 +75,9 @@ where('ArrayBuffer.isView').describe('ol.format.MVT', function() {
|
||||
});
|
||||
|
||||
it('sets the extent of the last readFeatures call', function() {
|
||||
var format = new MVT();
|
||||
const format = new MVT();
|
||||
format.readFeatures(data);
|
||||
var extent = format.getLastExtent();
|
||||
const extent = format.getLastExtent();
|
||||
expect(_ol_extent_.getWidth(extent)).to.be(4096);
|
||||
});
|
||||
|
||||
@@ -89,11 +89,11 @@ describe('ol.format.MVT', function() {
|
||||
|
||||
describe('#createFeature_', function() {
|
||||
it('accepts a geometryName', function() {
|
||||
var format = new MVT({
|
||||
const format = new MVT({
|
||||
featureClass: Feature,
|
||||
geometryName: 'myGeom'
|
||||
});
|
||||
var rawFeature = {
|
||||
const rawFeature = {
|
||||
id: 1,
|
||||
properties: {
|
||||
geometry: 'foo'
|
||||
@@ -103,68 +103,68 @@ describe('ol.format.MVT', function() {
|
||||
name: 'layer1'
|
||||
}
|
||||
};
|
||||
var readRawGeometry_ = MVT.readRawGeometry_;
|
||||
const readRawGeometry_ = MVT.readRawGeometry_;
|
||||
MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
flatCoordinates.push(0, 0);
|
||||
ends.push(2);
|
||||
};
|
||||
var feature = format.createFeature_({}, rawFeature);
|
||||
const feature = format.createFeature_({}, rawFeature);
|
||||
MVT.readRawGeometry_ = readRawGeometry_;
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.a(Point);
|
||||
expect(feature.get('myGeom')).to.equal(geometry);
|
||||
expect(feature.get('geometry')).to.be('foo');
|
||||
});
|
||||
|
||||
it('detects a Polygon', function() {
|
||||
var format = new MVT({
|
||||
const format = new MVT({
|
||||
featureClass: Feature
|
||||
});
|
||||
var rawFeature = {
|
||||
const rawFeature = {
|
||||
type: 3,
|
||||
properties: {},
|
||||
layer: {
|
||||
name: 'layer1'
|
||||
}
|
||||
};
|
||||
var readRawGeometry_ = MVT.readRawGeometry_;
|
||||
const readRawGeometry_ = MVT.readRawGeometry_;
|
||||
MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
flatCoordinates.push(0, 0, 3, 0, 3, 3, 3, 0, 0, 0);
|
||||
flatCoordinates.push(1, 1, 1, 2, 2, 2, 2, 1, 1, 1);
|
||||
ends.push(10, 20);
|
||||
};
|
||||
var feature = format.createFeature_({}, rawFeature);
|
||||
const feature = format.createFeature_({}, rawFeature);
|
||||
MVT.readRawGeometry_ = readRawGeometry_;
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.a(Polygon);
|
||||
});
|
||||
|
||||
it('detects a MultiPolygon', function() {
|
||||
var format = new MVT({
|
||||
const format = new MVT({
|
||||
featureClass: Feature
|
||||
});
|
||||
var rawFeature = {
|
||||
const rawFeature = {
|
||||
type: 3,
|
||||
properties: {},
|
||||
layer: {
|
||||
name: 'layer1'
|
||||
}
|
||||
};
|
||||
var readRawGeometry_ = MVT.readRawGeometry_;
|
||||
const readRawGeometry_ = MVT.readRawGeometry_;
|
||||
MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
flatCoordinates.push(0, 0, 1, 0, 1, 1, 1, 0, 0, 0);
|
||||
flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1);
|
||||
ends.push(10, 20);
|
||||
};
|
||||
var feature = format.createFeature_({}, rawFeature);
|
||||
const feature = format.createFeature_({}, rawFeature);
|
||||
MVT.readRawGeometry_ = readRawGeometry_;
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.a(MultiPolygon);
|
||||
});
|
||||
|
||||
it('creates ol.render.Feature instances', function() {
|
||||
var format = new MVT();
|
||||
var rawFeature = {
|
||||
const format = new MVT();
|
||||
const rawFeature = {
|
||||
type: 3,
|
||||
properties: {
|
||||
foo: 'bar'
|
||||
@@ -173,9 +173,9 @@ describe('ol.format.MVT', function() {
|
||||
name: 'layer1'
|
||||
}
|
||||
};
|
||||
var readRawGeometry_ = MVT.readRawGeometry_;
|
||||
var createdFlatCoordinates;
|
||||
var createdEnds;
|
||||
const readRawGeometry_ = MVT.readRawGeometry_;
|
||||
let createdFlatCoordinates;
|
||||
let createdEnds;
|
||||
MVT.readRawGeometry_ = function({}, rawFeature, flatCoordinates, ends) {
|
||||
flatCoordinates.push(0, 0, 1, 0, 1, 1, 1, 0, 0, 0);
|
||||
flatCoordinates.push(1, 1, 2, 1, 2, 2, 2, 1, 1, 1);
|
||||
@@ -183,7 +183,7 @@ describe('ol.format.MVT', function() {
|
||||
ends.push(10, 20);
|
||||
createdEnds = ends;
|
||||
};
|
||||
var feature = format.createFeature_({}, rawFeature);
|
||||
const feature = format.createFeature_({}, rawFeature);
|
||||
MVT.readRawGeometry_ = readRawGeometry_;
|
||||
expect(feature).to.be.a(RenderFeature);
|
||||
expect(feature.getType()).to.be('Polygon');
|
||||
|
||||
@@ -7,19 +7,19 @@ import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
describe('ol.format.OSMXML', function() {
|
||||
|
||||
var format;
|
||||
let format;
|
||||
beforeEach(function() {
|
||||
format = new OSMXML();
|
||||
});
|
||||
|
||||
describe('#readProjection', function() {
|
||||
it('returns the default projection from document', function() {
|
||||
var projection = format.readProjectionFromDocument();
|
||||
const projection = format.readProjectionFromDocument();
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
|
||||
it('returns the default projection from node', function() {
|
||||
var projection = format.readProjectionFromNode();
|
||||
const projection = format.readProjectionFromNode();
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
@@ -27,16 +27,16 @@ describe('ol.format.OSMXML', function() {
|
||||
describe('#readFeatures', function() {
|
||||
|
||||
it('can read an empty document', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
'<osm version="0.6" generator="my hand">' +
|
||||
'</osm>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(0);
|
||||
});
|
||||
|
||||
it('can read nodes', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
'<osm version="0.6" generator="my hand">' +
|
||||
' <node id="1" lat="1" lon="2">' +
|
||||
@@ -46,17 +46,17 @@ describe('ol.format.OSMXML', function() {
|
||||
' <tag k="name" v="2"/>' +
|
||||
' </node>' +
|
||||
'</osm>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(2);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1]);
|
||||
});
|
||||
|
||||
it('can read nodes and ways', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
'<osm version="0.6" generator="my hand">' +
|
||||
' <node id="1" lat="1" lon="2">' +
|
||||
@@ -71,14 +71,14 @@ describe('ol.format.OSMXML', function() {
|
||||
' <nd ref="2" />' +
|
||||
' </way>' +
|
||||
'</osm>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(3);
|
||||
var point = fs[0];
|
||||
const point = fs[0];
|
||||
expect(point).to.be.an(Feature);
|
||||
var g = point.getGeometry();
|
||||
let g = point.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql([2, 1]);
|
||||
var line = fs[2];
|
||||
const line = fs[2];
|
||||
expect(line).to.be.an(Feature);
|
||||
g = line.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
@@ -87,7 +87,7 @@ describe('ol.format.OSMXML', function() {
|
||||
|
||||
|
||||
it('can read ways before nodes', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
'<osm version="0.6" generator="my hand">' +
|
||||
' <way id="3">' +
|
||||
@@ -102,18 +102,18 @@ describe('ol.format.OSMXML', function() {
|
||||
' <tag k="name" v="2"/>' +
|
||||
' </node>' +
|
||||
'</osm>';
|
||||
var fs = format.readFeatures(text);
|
||||
const fs = format.readFeatures(text);
|
||||
expect(fs).to.have.length(3);
|
||||
var line = fs[2];
|
||||
const line = fs[2];
|
||||
expect(line).to.be.an(Feature);
|
||||
var g = line.getGeometry();
|
||||
const g = line.getGeometry();
|
||||
expect(g).to.be.an(LineString);
|
||||
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
|
||||
});
|
||||
|
||||
|
||||
it('can transform and read nodes', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
'<osm version="0.6" generator="my hand">' +
|
||||
' <node id="1" lat="1" lon="2">' +
|
||||
@@ -123,16 +123,16 @@ describe('ol.format.OSMXML', function() {
|
||||
' <tag k="name" v="2"/>' +
|
||||
' </node>' +
|
||||
'</osm>';
|
||||
var fs = format.readFeatures(text, {
|
||||
const fs = format.readFeatures(text, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(fs).to.have.length(2);
|
||||
var f = fs[0];
|
||||
const f = fs[0];
|
||||
expect(f).to.be.an(Feature);
|
||||
var g = f.getGeometry();
|
||||
const g = f.getGeometry();
|
||||
expect(g).to.be.an(Point);
|
||||
expect(g.getCoordinates()).to.eql(
|
||||
transform([2, 1], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([2, 1], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -4,11 +4,11 @@ import _ol_xml_ from '../../../../src/ol/xml.js';
|
||||
|
||||
describe('ol.format.OWS 1.1', function() {
|
||||
|
||||
var parser = new OWS();
|
||||
const parser = new OWS();
|
||||
|
||||
it('should read ServiceProvider tag properly', function() {
|
||||
var doc = _ol_xml_.parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
const doc = _ol_xml_.parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
|
||||
'<ows:ServiceProvider>' +
|
||||
'<ows:ProviderName>MiraMon</ows:ProviderName>' +
|
||||
@@ -42,22 +42,22 @@ describe('ol.format.OWS 1.1', function() {
|
||||
'</ows:GetCapabilities>'
|
||||
);
|
||||
|
||||
var obj = parser.read(doc);
|
||||
const obj = parser.read(doc);
|
||||
expect(obj).to.be.ok();
|
||||
var serviceProvider = obj.ServiceProvider;
|
||||
const serviceProvider = obj.ServiceProvider;
|
||||
expect(serviceProvider).to.be.ok();
|
||||
expect(serviceProvider.ProviderName).to.eql('MiraMon');
|
||||
var url = 'http://www.creaf.uab.es/miramon';
|
||||
const url = 'http://www.creaf.uab.es/miramon';
|
||||
expect(serviceProvider.ProviderSite).to.eql(url);
|
||||
var name = 'Joan Maso Pau';
|
||||
const name = 'Joan Maso Pau';
|
||||
expect(serviceProvider.ServiceContact.IndividualName).to.eql(name);
|
||||
var position = 'Senior Software Engineer';
|
||||
const position = 'Senior Software Engineer';
|
||||
expect(serviceProvider.ServiceContact.PositionName).to.eql(position);
|
||||
});
|
||||
|
||||
it('should read ServiceIdentification tag properly', function() {
|
||||
var doc = _ol_xml_.parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
const doc = _ol_xml_.parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
|
||||
'<ows:ServiceIdentification>' +
|
||||
'<ows:Title>Web Map Tile Service</ows:Title>' +
|
||||
@@ -75,13 +75,13 @@ describe('ol.format.OWS 1.1', function() {
|
||||
'</ows:ServiceIdentification>' +
|
||||
'</ows:GetCapabilities>'
|
||||
);
|
||||
var obj = parser.readFromNode(doc.firstChild);
|
||||
const obj = parser.readFromNode(doc.firstChild);
|
||||
expect(obj).to.be.ok();
|
||||
|
||||
var serviceIdentification = obj.ServiceIdentification;
|
||||
const serviceIdentification = obj.ServiceIdentification;
|
||||
expect(serviceIdentification).to.be.ok();
|
||||
expect(serviceIdentification.Abstract).to.eql(
|
||||
'Service that contrains the map access interface to some TileMatrixSets'
|
||||
'Service that contrains the map access interface to some TileMatrixSets'
|
||||
);
|
||||
expect(serviceIdentification.AccessConstraints).to.eql('none');
|
||||
expect(serviceIdentification.Fees).to.eql('none');
|
||||
@@ -91,8 +91,8 @@ describe('ol.format.OWS 1.1', function() {
|
||||
});
|
||||
|
||||
it('should read OperationsMetadata tag properly', function() {
|
||||
var doc = _ol_xml_.parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
const doc = _ol_xml_.parse(
|
||||
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
|
||||
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
|
||||
'<ows:OperationsMetadata>' +
|
||||
'<ows:Operation name="GetCapabilities">' +
|
||||
@@ -133,14 +133,14 @@ describe('ol.format.OWS 1.1', function() {
|
||||
'</ows:OperationsMetadata>' +
|
||||
'</ows:GetCapabilities>'
|
||||
);
|
||||
var obj = parser.readFromNode(doc.firstChild);
|
||||
const obj = parser.readFromNode(doc.firstChild);
|
||||
expect(obj).to.be.ok();
|
||||
|
||||
var operationsMetadata = obj.OperationsMetadata;
|
||||
const operationsMetadata = obj.OperationsMetadata;
|
||||
expect(operationsMetadata).to.be.ok();
|
||||
var getCap = operationsMetadata.GetCapabilities;
|
||||
var dcp = getCap.DCP;
|
||||
var url = 'http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?';
|
||||
const getCap = operationsMetadata.GetCapabilities;
|
||||
let dcp = getCap.DCP;
|
||||
let url = 'http://www.miramon.uab.es/cgi-bin/MiraMon5_0.cgi?';
|
||||
expect(dcp.HTTP.Get[0].href).to.eql(url);
|
||||
expect(dcp.HTTP.Get[0].Constraint[0].name).to.eql('GetEncoding');
|
||||
expect(dcp.HTTP.Get[0].Constraint[0].AllowedValues.Value[0]).to.eql('KVP');
|
||||
|
||||
@@ -5,13 +5,13 @@ import {get as getProjection, transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
describe('ol.format.Polyline', function() {
|
||||
|
||||
var format;
|
||||
var points;
|
||||
var flatPoints, encodedFlatPoints, flippedFlatPoints;
|
||||
var floats, smallFloats, encodedFloats;
|
||||
var signedIntegers, encodedSignedIntegers;
|
||||
var unsignedIntegers, encodedUnsignedIntegers;
|
||||
var points3857;
|
||||
let format;
|
||||
let points;
|
||||
let flatPoints, encodedFlatPoints, flippedFlatPoints;
|
||||
let floats, smallFloats, encodedFloats;
|
||||
let signedIntegers, encodedSignedIntegers;
|
||||
let unsignedIntegers, encodedUnsignedIntegers;
|
||||
let points3857;
|
||||
|
||||
function resetTestingData() {
|
||||
format = new Polyline();
|
||||
@@ -53,14 +53,14 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('#readProjectionFromText', function() {
|
||||
it('returns the default projection', function() {
|
||||
var projection = format.readProjectionFromText(encodedFlatPoints);
|
||||
const projection = format.readProjectionFromText(encodedFlatPoints);
|
||||
expect(projection).to.eql(getProjection('EPSG:4326'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('encodeDeltas', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeDeltas = polyline.encodeDeltas;
|
||||
const encodeDeltas = polyline.encodeDeltas;
|
||||
|
||||
expect(encodeDeltas(flippedFlatPoints, 2)).to.eql(encodedFlatPoints);
|
||||
});
|
||||
@@ -68,7 +68,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeDeltas', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeDeltas = polyline.decodeDeltas;
|
||||
const decodeDeltas = polyline.decodeDeltas;
|
||||
|
||||
expect(decodeDeltas(encodedFlatPoints, 2)).to.eql(flippedFlatPoints);
|
||||
});
|
||||
@@ -77,7 +77,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('encodeFloats', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeFloats = polyline.encodeFloats;
|
||||
const encodeFloats = polyline.encodeFloats;
|
||||
|
||||
expect(encodeFloats(smallFloats)).to.eql(encodedFloats);
|
||||
|
||||
@@ -90,7 +90,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeFloats', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeFloats = polyline.decodeFloats;
|
||||
const decodeFloats = polyline.decodeFloats;
|
||||
|
||||
expect(decodeFloats(encodedFloats)).to.eql(smallFloats);
|
||||
expect(decodeFloats(encodedFloats, 1e5)).to.eql(smallFloats);
|
||||
@@ -101,45 +101,45 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('encodeSignedIntegers', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeSignedIntegers = polyline.encodeSignedIntegers;
|
||||
const encodeSignedIntegers = polyline.encodeSignedIntegers;
|
||||
|
||||
expect(encodeSignedIntegers(
|
||||
signedIntegers)).to.eql(encodedSignedIntegers);
|
||||
signedIntegers)).to.eql(encodedSignedIntegers);
|
||||
});
|
||||
});
|
||||
|
||||
describe('decodeSignedIntegers', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeSignedIntegers = polyline.decodeSignedIntegers;
|
||||
const decodeSignedIntegers = polyline.decodeSignedIntegers;
|
||||
|
||||
expect(decodeSignedIntegers(
|
||||
encodedSignedIntegers)).to.eql(signedIntegers);
|
||||
encodedSignedIntegers)).to.eql(signedIntegers);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('encodeUnsignedIntegers', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeUnsignedIntegers = polyline.encodeUnsignedIntegers;
|
||||
const encodeUnsignedIntegers = polyline.encodeUnsignedIntegers;
|
||||
|
||||
expect(encodeUnsignedIntegers(
|
||||
unsignedIntegers)).to.eql(encodedUnsignedIntegers);
|
||||
unsignedIntegers)).to.eql(encodedUnsignedIntegers);
|
||||
});
|
||||
});
|
||||
|
||||
describe('decodeUnsignedIntegers', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeUnsignedIntegers = polyline.decodeUnsignedIntegers;
|
||||
const decodeUnsignedIntegers = polyline.decodeUnsignedIntegers;
|
||||
|
||||
expect(decodeUnsignedIntegers(
|
||||
encodedUnsignedIntegers)).to.eql(unsignedIntegers);
|
||||
encodedUnsignedIntegers)).to.eql(unsignedIntegers);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('encodeFloat', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeFloats = polyline.encodeFloats;
|
||||
const encodeFloats = polyline.encodeFloats;
|
||||
|
||||
expect(encodeFloats([0.00000])).to.eql('?');
|
||||
expect(encodeFloats([-0.00001])).to.eql('@');
|
||||
@@ -162,7 +162,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeFloat', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeFloats = polyline.decodeFloats;
|
||||
const decodeFloats = polyline.decodeFloats;
|
||||
|
||||
expect(decodeFloats('?')).to.eql([0.00000]);
|
||||
expect(decodeFloats('@')).to.eql([-0.00001]);
|
||||
@@ -186,7 +186,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('encodeSignedInteger', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeSignedIntegers = polyline.encodeSignedIntegers;
|
||||
const encodeSignedIntegers = polyline.encodeSignedIntegers;
|
||||
|
||||
expect(encodeSignedIntegers([0])).to.eql('?');
|
||||
expect(encodeSignedIntegers([-1])).to.eql('@');
|
||||
@@ -204,7 +204,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeSignedInteger', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeSignedIntegers = polyline.decodeSignedIntegers;
|
||||
const decodeSignedIntegers = polyline.decodeSignedIntegers;
|
||||
|
||||
expect(decodeSignedIntegers('?')).to.eql([0]);
|
||||
expect(decodeSignedIntegers('@')).to.eql([-1]);
|
||||
@@ -223,7 +223,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('encodeUnsignedInteger', function() {
|
||||
it('returns expected value', function() {
|
||||
var encodeUnsignedInteger = polyline.encodeUnsignedInteger;
|
||||
const encodeUnsignedInteger = polyline.encodeUnsignedInteger;
|
||||
|
||||
expect(encodeUnsignedInteger(0)).to.eql('?');
|
||||
expect(encodeUnsignedInteger(1)).to.eql('@');
|
||||
@@ -243,7 +243,7 @@ describe('ol.format.Polyline', function() {
|
||||
|
||||
describe('decodeUnsignedInteger', function() {
|
||||
it('returns expected value', function() {
|
||||
var decodeUnsignedIntegers = polyline.decodeUnsignedIntegers;
|
||||
const decodeUnsignedIntegers = polyline.decodeUnsignedIntegers;
|
||||
|
||||
expect(decodeUnsignedIntegers('?')).to.eql([0]);
|
||||
expect(decodeUnsignedIntegers('@')).to.eql([1]);
|
||||
@@ -264,19 +264,19 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#readFeature', function() {
|
||||
|
||||
it('returns the expected feature', function() {
|
||||
var feature = format.readFeature(encodedFlatPoints);
|
||||
const feature = format.readFeature(encodedFlatPoints);
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getFlatCoordinates()).to.eql(flatPoints);
|
||||
});
|
||||
|
||||
it('transforms and returns the expected feature', function() {
|
||||
var feature = format.readFeature(encodedFlatPoints, {
|
||||
const feature = format.readFeature(encodedFlatPoints, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getCoordinates()).to.eql(points3857);
|
||||
});
|
||||
@@ -286,25 +286,25 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#readFeatures', function() {
|
||||
|
||||
it('returns the expected feature', function() {
|
||||
var features = format.readFeatures(encodedFlatPoints);
|
||||
const features = format.readFeatures(encodedFlatPoints);
|
||||
expect(features).to.be.an(Array);
|
||||
expect(features).to.have.length(1);
|
||||
var feature = features[0];
|
||||
const feature = features[0];
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getFlatCoordinates()).to.eql(flatPoints);
|
||||
});
|
||||
|
||||
it('transforms and returns the expected features', function() {
|
||||
var features = format.readFeatures(encodedFlatPoints, {
|
||||
const features = format.readFeatures(encodedFlatPoints, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(features).to.be.an(Array);
|
||||
expect(features).to.have.length(1);
|
||||
var feature = features[0];
|
||||
const feature = features[0];
|
||||
expect(feature).to.be.an(Feature);
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getCoordinates()).to.eql(points3857);
|
||||
});
|
||||
@@ -314,22 +314,22 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#readGeometry', function() {
|
||||
|
||||
it('returns the expected geometry', function() {
|
||||
var geometry = format.readGeometry(encodedFlatPoints);
|
||||
const geometry = format.readGeometry(encodedFlatPoints);
|
||||
expect(geometry).to.be.an(LineString);
|
||||
expect(geometry.getFlatCoordinates()).to.eql(flatPoints);
|
||||
});
|
||||
|
||||
it('parses XYZ linestring', function() {
|
||||
var xyz = polyline.encodeDeltas([
|
||||
const xyz = polyline.encodeDeltas([
|
||||
38.500, -120.200, 100,
|
||||
40.700, -120.950, 200,
|
||||
43.252, -126.453, 20
|
||||
], 3);
|
||||
var format = new Polyline({
|
||||
const format = new Polyline({
|
||||
geometryLayout: 'XYZ'
|
||||
});
|
||||
|
||||
var geometry = format.readGeometry(xyz);
|
||||
const geometry = format.readGeometry(xyz);
|
||||
expect(geometry.getLayout()).to.eql('XYZ');
|
||||
expect(geometry.getCoordinates()).to.eql([
|
||||
[-120.200, 38.500, 100],
|
||||
@@ -339,7 +339,7 @@ describe('ol.format.Polyline', function() {
|
||||
});
|
||||
|
||||
it('transforms and returns the expected geometry', function() {
|
||||
var geometry = format.readGeometry(encodedFlatPoints, {
|
||||
const geometry = format.readGeometry(encodedFlatPoints, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(geometry).to.be.an(LineString);
|
||||
@@ -351,7 +351,7 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#readProjection', function() {
|
||||
|
||||
it('returns the expected projection', function() {
|
||||
var projection = format.readProjection(encodedFlatPoints);
|
||||
const projection = format.readProjection(encodedFlatPoints);
|
||||
expect(projection).to.be(getProjection('EPSG:4326'));
|
||||
});
|
||||
|
||||
@@ -360,12 +360,12 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#writeFeature', function() {
|
||||
|
||||
it('returns the expected text', function() {
|
||||
var feature = new Feature(new LineString(points));
|
||||
const feature = new Feature(new LineString(points));
|
||||
expect(format.writeFeature(feature)).to.be(encodedFlatPoints);
|
||||
});
|
||||
|
||||
it('transforms and returns the expected text', function() {
|
||||
var feature = new Feature(new LineString(points3857));
|
||||
const feature = new Feature(new LineString(points3857));
|
||||
expect(format.writeFeature(feature, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
})).to.be(encodedFlatPoints);
|
||||
@@ -376,12 +376,12 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#writeFeature', function() {
|
||||
|
||||
it('returns the expected text', function() {
|
||||
var features = [new Feature(new LineString(points))];
|
||||
const features = [new Feature(new LineString(points))];
|
||||
expect(format.writeFeatures(features)).to.be(encodedFlatPoints);
|
||||
});
|
||||
|
||||
it('transforms and returns the expected text', function() {
|
||||
var features = [new Feature(new LineString(points3857))];
|
||||
const features = [new Feature(new LineString(points3857))];
|
||||
expect(format.writeFeatures(features, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
})).to.be(encodedFlatPoints);
|
||||
@@ -392,12 +392,12 @@ describe('ol.format.Polyline', function() {
|
||||
describe('#writeGeometry', function() {
|
||||
|
||||
it('returns the expected text', function() {
|
||||
var geometry = new LineString(points);
|
||||
const geometry = new LineString(points);
|
||||
expect(format.writeGeometry(geometry)).to.be(encodedFlatPoints);
|
||||
});
|
||||
|
||||
it('transforms and returns the expected text', function() {
|
||||
var geometry = new LineString(points3857);
|
||||
const geometry = new LineString(points3857);
|
||||
expect(format.writeGeometry(geometry, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
})).to.be(encodedFlatPoints);
|
||||
|
||||
@@ -5,7 +5,7 @@ import FeatureFormat from '../../../../src/ol/format/Feature.js';
|
||||
import {transform} from '../../../../src/ol/proj.js';
|
||||
import TopoJSON from '../../../../src/ol/format/TopoJSON.js';
|
||||
|
||||
var aruba = {
|
||||
const aruba = {
|
||||
type: 'Topology',
|
||||
transform: {
|
||||
scale: [0.036003600360036005, 0.017361589674592462],
|
||||
@@ -27,7 +27,7 @@ var aruba = {
|
||||
]
|
||||
};
|
||||
|
||||
var zeroId = {
|
||||
const zeroId = {
|
||||
type: 'Topology',
|
||||
objects: {
|
||||
foobar: {
|
||||
@@ -40,7 +40,7 @@ var zeroId = {
|
||||
|
||||
describe('ol.format.TopoJSON', function() {
|
||||
|
||||
var format;
|
||||
let format;
|
||||
before(function() {
|
||||
format = new TopoJSON();
|
||||
});
|
||||
@@ -55,13 +55,13 @@ describe('ol.format.TopoJSON', function() {
|
||||
describe('#readFeaturesFromTopology_()', function() {
|
||||
|
||||
it('creates an array of features from a topology', function() {
|
||||
var features = format.readFeaturesFromObject(aruba);
|
||||
const features = format.readFeaturesFromObject(aruba);
|
||||
expect(features).to.have.length(1);
|
||||
|
||||
var feature = features[0];
|
||||
const feature = features[0];
|
||||
expect(feature).to.be.a(Feature);
|
||||
|
||||
var geometry = feature.getGeometry();
|
||||
const geometry = feature.getGeometry();
|
||||
expect(geometry).to.be.a(Polygon);
|
||||
|
||||
// Parses identifier
|
||||
@@ -76,10 +76,10 @@ describe('ol.format.TopoJSON', function() {
|
||||
});
|
||||
|
||||
it('can read a feature with id equal to 0', function() {
|
||||
var features = format.readFeaturesFromObject(zeroId);
|
||||
const features = format.readFeaturesFromObject(zeroId);
|
||||
expect(features).to.have.length(1);
|
||||
|
||||
var feature = features[0];
|
||||
const feature = features[0];
|
||||
expect(feature).to.be.a(Feature);
|
||||
expect(feature.getId()).to.be(0);
|
||||
});
|
||||
@@ -90,20 +90,20 @@ describe('ol.format.TopoJSON', function() {
|
||||
|
||||
it('parses simple.json', function(done) {
|
||||
afterLoadText('spec/ol/format/topojson/simple.json', function(text) {
|
||||
var features = format.readFeatures(text);
|
||||
const features = format.readFeatures(text);
|
||||
expect(features.length).to.be(3);
|
||||
|
||||
var point = features[0].getGeometry();
|
||||
const point = features[0].getGeometry();
|
||||
expect(point.getType()).to.be('Point');
|
||||
expect(point.getFlatCoordinates()).to.eql([102, 0.5]);
|
||||
|
||||
var line = features[1].getGeometry();
|
||||
const line = features[1].getGeometry();
|
||||
expect(line.getType()).to.be('LineString');
|
||||
expect(line.getFlatCoordinates()).to.eql([
|
||||
102, 0, 103, 1, 104, 0, 105, 1
|
||||
]);
|
||||
|
||||
var polygon = features[2].getGeometry();
|
||||
const polygon = features[2].getGeometry();
|
||||
expect(polygon.getType()).to.be('Polygon');
|
||||
expect(polygon.getFlatCoordinates()).to.eql([
|
||||
100, 0, 100, 1, 101, 1, 101, 0, 100, 0
|
||||
@@ -115,17 +115,17 @@ describe('ol.format.TopoJSON', function() {
|
||||
|
||||
it('parses simple.json and transforms', function(done) {
|
||||
afterLoadText('spec/ol/format/topojson/simple.json', function(text) {
|
||||
var features = format.readFeatures(text, {
|
||||
const features = format.readFeatures(text, {
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(features.length).to.be(3);
|
||||
|
||||
var point = features[0].getGeometry();
|
||||
const point = features[0].getGeometry();
|
||||
expect(point.getType()).to.be('Point');
|
||||
expect(features[0].getGeometry().getCoordinates()).to.eql(
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([102.0, 0.5], 'EPSG:4326', 'EPSG:3857'));
|
||||
|
||||
var line = features[1].getGeometry();
|
||||
const line = features[1].getGeometry();
|
||||
expect(line.getType()).to.be('LineString');
|
||||
expect(line.getCoordinates()).to.eql([
|
||||
transform([102.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
@@ -134,7 +134,7 @@ describe('ol.format.TopoJSON', function() {
|
||||
transform([105.0, 1.0], 'EPSG:4326', 'EPSG:3857')
|
||||
]);
|
||||
|
||||
var polygon = features[2].getGeometry();
|
||||
const polygon = features[2].getGeometry();
|
||||
expect(polygon.getType()).to.be('Polygon');
|
||||
expect(polygon.getCoordinates()).to.eql([[
|
||||
transform([100.0, 0.0], 'EPSG:4326', 'EPSG:3857'),
|
||||
@@ -151,19 +151,19 @@ describe('ol.format.TopoJSON', function() {
|
||||
it('parses world-110m.json', function(done) {
|
||||
afterLoadText('spec/ol/format/topojson/world-110m.json', function(text) {
|
||||
|
||||
var features = format.readFeatures(text);
|
||||
const features = format.readFeatures(text);
|
||||
expect(features.length).to.be(178);
|
||||
|
||||
var first = features[0];
|
||||
const first = features[0];
|
||||
expect(first).to.be.a(Feature);
|
||||
var firstGeom = first.getGeometry();
|
||||
const firstGeom = first.getGeometry();
|
||||
expect(firstGeom).to.be.a(MultiPolygon);
|
||||
expect(firstGeom.getExtent()).to.eql(
|
||||
[-180, -85.60903777459777, 180, 83.64513000000002]);
|
||||
[-180, -85.60903777459777, 180, 83.64513000000002]);
|
||||
|
||||
var last = features[177];
|
||||
const last = features[177];
|
||||
expect(last).to.be.a(Feature);
|
||||
var lastGeom = last.getGeometry();
|
||||
const lastGeom = last.getGeometry();
|
||||
expect(lastGeom).to.be.a(Polygon);
|
||||
expect(lastGeom.getExtent()).to.eql([
|
||||
25.26325263252633, -22.271802279310577,
|
||||
@@ -176,10 +176,10 @@ describe('ol.format.TopoJSON', function() {
|
||||
|
||||
it('sets the topology\'s child names as feature property', function(done) {
|
||||
afterLoadText('spec/ol/format/topojson/world-110m.json', function(text) {
|
||||
var format = new TopoJSON({
|
||||
const format = new TopoJSON({
|
||||
layerName: 'layer'
|
||||
});
|
||||
var features = format.readFeatures(text);
|
||||
const features = format.readFeatures(text);
|
||||
expect(features[0].get('layer')).to.be('land');
|
||||
expect(features[177].get('layer')).to.be('countries');
|
||||
done();
|
||||
@@ -188,10 +188,10 @@ describe('ol.format.TopoJSON', function() {
|
||||
|
||||
it('only parses features from specified topology\'s children', function(done) {
|
||||
afterLoadText('spec/ol/format/topojson/world-110m.json', function(text) {
|
||||
var format = new TopoJSON({
|
||||
const format = new TopoJSON({
|
||||
layers: ['land']
|
||||
});
|
||||
var features = format.readFeatures(text);
|
||||
const features = format.readFeatures(text);
|
||||
expect(features.length).to.be(1);
|
||||
done();
|
||||
});
|
||||
|
||||
+199
-198
@@ -16,7 +16,7 @@ describe('ol.format.WFS', function() {
|
||||
describe('featureType', function() {
|
||||
|
||||
it('#getFeatureType #setFeatureType', function() {
|
||||
var format = new WFS({
|
||||
const format = new WFS({
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featureType: ['foo', 'bar']
|
||||
});
|
||||
@@ -29,8 +29,8 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
describe('when parsing TOPP states GML from WFS', function() {
|
||||
|
||||
var features, feature, xml;
|
||||
var config = {
|
||||
let features, feature, xml;
|
||||
const config = {
|
||||
'featureNS': 'http://www.openplans.org/topp',
|
||||
'featureType': 'states'
|
||||
};
|
||||
@@ -73,9 +73,9 @@ describe('ol.format.WFS', function() {
|
||||
feature = features[0];
|
||||
expect(feature.getId()).to.equal('states.1');
|
||||
expect(feature.get('STATE_NAME')).to.equal('Illinois');
|
||||
var geom = feature.getGeometry();
|
||||
const geom = feature.getGeometry();
|
||||
expect(geom).to.be.an(MultiPolygon);
|
||||
var p = transform([-88.071, 37.511], 'EPSG:4326', 'EPSG:3857');
|
||||
const p = transform([-88.071, 37.511], 'EPSG:4326', 'EPSG:3857');
|
||||
p.push(0);
|
||||
expect(geom.getFirstCoordinate()).to.eql(p);
|
||||
});
|
||||
@@ -84,8 +84,8 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
describe('when parsing mapserver GML2 polygon', function() {
|
||||
|
||||
var features, feature, xml;
|
||||
var config = {
|
||||
let features, feature, xml;
|
||||
const config = {
|
||||
'featureNS': 'http://mapserver.gis.umn.edu/mapserver',
|
||||
'featureType': 'polygon',
|
||||
'gmlFormat': new GML2()
|
||||
@@ -120,41 +120,41 @@ describe('ol.format.WFS', function() {
|
||||
expect(feature.getId()).to.equal('1');
|
||||
expect(feature.get('name')).to.equal('My Polygon with hole');
|
||||
expect(feature.get('boundedBy')).to.eql(
|
||||
[47.003018, -0.768746, 47.925567, 0.532597]);
|
||||
[47.003018, -0.768746, 47.925567, 0.532597]);
|
||||
expect(feature.getGeometry()).to.be.an(MultiPolygon);
|
||||
expect(feature.getGeometry().getFlatCoordinates()).
|
||||
to.have.length(60);
|
||||
to.have.length(60);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('when parsing FeatureCollection', function() {
|
||||
var xml;
|
||||
let xml;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wfs/EmptyFeatureCollection.xml',
|
||||
function(_xml) {
|
||||
xml = _xml;
|
||||
done();
|
||||
});
|
||||
function(_xml) {
|
||||
xml = _xml;
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('returns an empty array of features when none exist', function() {
|
||||
var result = new WFS().readFeatures(xml);
|
||||
const result = new WFS().readFeatures(xml);
|
||||
expect(result).to.have.length(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when parsing FeatureCollection', function() {
|
||||
var response;
|
||||
let response;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wfs/NumberOfFeatures.xml',
|
||||
function(xml) {
|
||||
try {
|
||||
response = new WFS().readFeatureCollectionMetadata(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
done();
|
||||
});
|
||||
function(xml) {
|
||||
try {
|
||||
response = new WFS().readFeatureCollectionMetadata(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('returns the correct number of features', function() {
|
||||
expect(response.numberOfFeatures).to.equal(625);
|
||||
@@ -162,7 +162,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
describe('when parsing FeatureCollection', function() {
|
||||
var response;
|
||||
let response;
|
||||
before(function(done) {
|
||||
proj4.defs('EPSG:28992', '+proj=sterea +lat_0=52.15616055555555 ' +
|
||||
'+lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 ' +
|
||||
@@ -170,14 +170,14 @@ describe('ol.format.WFS', function() {
|
||||
'-1.8774,4.0725 +units=m +no_defs');
|
||||
register(proj4);
|
||||
afterLoadText('spec/ol/format/wfs/boundedBy.xml',
|
||||
function(xml) {
|
||||
try {
|
||||
response = new WFS().readFeatureCollectionMetadata(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
done();
|
||||
});
|
||||
function(xml) {
|
||||
try {
|
||||
response = new WFS().readFeatureCollectionMetadata(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('returns the correct bounds', function() {
|
||||
expect(response.bounds).to.eql([3197.88, 306457.313,
|
||||
@@ -186,17 +186,17 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
describe('when parsing TransactionResponse', function() {
|
||||
var response;
|
||||
let response;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wfs/TransactionResponse.xml',
|
||||
function(xml) {
|
||||
try {
|
||||
response = new WFS().readTransactionResponse(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
done();
|
||||
});
|
||||
function(xml) {
|
||||
try {
|
||||
response = new WFS().readTransactionResponse(xml);
|
||||
} catch (e) {
|
||||
done(e);
|
||||
}
|
||||
done();
|
||||
});
|
||||
});
|
||||
it('returns the correct TransactionResponse object', function() {
|
||||
expect(response.transactionSummary.totalDeleted).to.equal(0);
|
||||
@@ -210,7 +210,7 @@ describe('ol.format.WFS', function() {
|
||||
describe('when writing out a GetFeature request', function() {
|
||||
|
||||
it('creates the expected output', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:GetFeature service="WFS" version="1.1.0" resultType="hits" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp"' +
|
||||
' xmlns:wfs="http://www.opengis.net/wfs"' +
|
||||
@@ -226,7 +226,7 @@ describe('ol.format.WFS', function() {
|
||||
' <wfs:PropertyName>STATE_ABBR</wfs:PropertyName>' +
|
||||
' </wfs:Query>' +
|
||||
'</wfs:GetFeature>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
resultType: 'hits',
|
||||
featureTypes: ['states'],
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
@@ -238,7 +238,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates paging headers', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:GetFeature service="WFS" version="1.1.0" startIndex="20" ' +
|
||||
' count="10" xmlns:topp="http://www.openplans.org/topp"' +
|
||||
' xmlns:wfs="http://www.opengis.net/wfs"' +
|
||||
@@ -251,7 +251,7 @@ describe('ol.format.WFS', function() {
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
' </wfs:Query>' +
|
||||
'</wfs:GetFeature>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
count: 10,
|
||||
startIndex: 20,
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
@@ -263,7 +263,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates a BBOX filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -278,7 +278,7 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:BBOX>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
@@ -290,7 +290,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates a property filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -301,7 +301,7 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:PropertyIsEqualTo>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
@@ -312,7 +312,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates two property filters', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -329,20 +329,20 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Or>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: _ol_format_filter_.or(
|
||||
_ol_format_filter_.equalTo('name', 'New York'),
|
||||
_ol_format_filter_.equalTo('area', 1234))
|
||||
_ol_format_filter_.equalTo('name', 'New York'),
|
||||
_ol_format_filter_.equalTo('area', 1234))
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates greater/less than property filters', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -371,27 +371,27 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Or>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: _ol_format_filter_.or(
|
||||
_ol_format_filter_.and(
|
||||
_ol_format_filter_.greaterThan('area', 100),
|
||||
_ol_format_filter_.greaterThanOrEqualTo('pop', 20000)
|
||||
),
|
||||
_ol_format_filter_.and(
|
||||
_ol_format_filter_.lessThan('area', 100),
|
||||
_ol_format_filter_.lessThanOrEqualTo('pop', 20000)
|
||||
)
|
||||
_ol_format_filter_.and(
|
||||
_ol_format_filter_.greaterThan('area', 100),
|
||||
_ol_format_filter_.greaterThanOrEqualTo('pop', 20000)
|
||||
),
|
||||
_ol_format_filter_.and(
|
||||
_ol_format_filter_.lessThan('area', 100),
|
||||
_ol_format_filter_.lessThanOrEqualTo('pop', 20000)
|
||||
)
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates isBetween property filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -403,7 +403,7 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:PropertyIsBetween>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
@@ -414,7 +414,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates isNull property filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -424,7 +424,7 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:PropertyIsNull>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
@@ -435,7 +435,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates isLike property filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -446,7 +446,7 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:PropertyIsLike>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
@@ -457,7 +457,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates isLike property filter with arguments', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -468,7 +468,7 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:PropertyIsLike>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
@@ -479,7 +479,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates a Not filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -492,7 +492,7 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Not>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
@@ -503,7 +503,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates an AND filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="topp:states" srsName="urn:ogc:def:crs:EPSG::4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -528,22 +528,22 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:And>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'urn:ogc:def:crs:EPSG::4326',
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featurePrefix: 'topp',
|
||||
featureTypes: ['states'],
|
||||
filter: _ol_format_filter_.and(
|
||||
_ol_format_filter_.equalTo('name', 'New York'),
|
||||
_ol_format_filter_.bbox('the_geom', [1, 2, 3, 4], 'urn:ogc:def:crs:EPSG::4326'),
|
||||
_ol_format_filter_.greaterThan('population', 2000000)
|
||||
_ol_format_filter_.equalTo('name', 'New York'),
|
||||
_ol_format_filter_.bbox('the_geom', [1, 2, 3, 4], 'urn:ogc:def:crs:EPSG::4326'),
|
||||
_ol_format_filter_.greaterThan('population', 2000000)
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates a contains filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="area" srsName="EPSG:4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -562,25 +562,25 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Contains>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'EPSG:4326',
|
||||
featureTypes: ['area'],
|
||||
filter: _ol_format_filter_.contains(
|
||||
'the_geom',
|
||||
new Polygon([[
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
[15, 20],
|
||||
[10, 20]
|
||||
]])
|
||||
'the_geom',
|
||||
new Polygon([[
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
[15, 20],
|
||||
[10, 20]
|
||||
]])
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates a intersects filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="area" srsName="EPSG:4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -599,25 +599,25 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Intersects>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'EPSG:4326',
|
||||
featureTypes: ['area'],
|
||||
filter: _ol_format_filter_.intersects(
|
||||
'the_geom',
|
||||
new Polygon([[
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
[15, 20],
|
||||
[10, 20]
|
||||
]])
|
||||
'the_geom',
|
||||
new Polygon([[
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
[15, 20],
|
||||
[10, 20]
|
||||
]])
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates a within filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="area" srsName="EPSG:4326" ' +
|
||||
' xmlns:topp="http://www.openplans.org/topp">' +
|
||||
@@ -636,25 +636,25 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Within>' +
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'EPSG:4326',
|
||||
featureTypes: ['area'],
|
||||
filter: _ol_format_filter_.within(
|
||||
'the_geom',
|
||||
new Polygon([[
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
[15, 20],
|
||||
[10, 20]
|
||||
]])
|
||||
'the_geom',
|
||||
new Polygon([[
|
||||
[10, 20],
|
||||
[10, 25],
|
||||
[15, 25],
|
||||
[15, 20],
|
||||
[10, 20]
|
||||
]])
|
||||
)
|
||||
});
|
||||
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
it('creates During property filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Query xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
' typeName="states" srsName="EPSG:4326">' +
|
||||
' <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">' +
|
||||
@@ -676,7 +676,7 @@ describe('ol.format.WFS', function() {
|
||||
' </ogc:Filter>' +
|
||||
'</wfs:Query>';
|
||||
|
||||
var serialized = new WFS().writeGetFeature({
|
||||
const serialized = new WFS().writeGetFeature({
|
||||
srsName: 'EPSG:4326',
|
||||
featureTypes: ['states'],
|
||||
filter: _ol_format_filter_.during('date_prop', '2010-01-20T00:00:00Z', '2012-12-31T00:00:00Z')
|
||||
@@ -689,21 +689,21 @@ describe('ol.format.WFS', function() {
|
||||
describe('when writing out a Transaction request', function() {
|
||||
|
||||
it('creates a handle', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" ' +
|
||||
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' +
|
||||
'service="WFS" version="1.1.0" handle="handle_t" ' +
|
||||
'xsi:schemaLocation="http://www.opengis.net/wfs ' +
|
||||
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>';
|
||||
var serialized = new WFS().writeTransaction(null, null, null,
|
||||
{handle: 'handle_t'});
|
||||
const serialized = new WFS().writeTransaction(null, null, null,
|
||||
{handle: 'handle_t'});
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('when writing out a Transaction request', function() {
|
||||
var text;
|
||||
let text;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wfs/TransactionSrs.xml', function(xml) {
|
||||
text = xml;
|
||||
@@ -711,8 +711,8 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
});
|
||||
it('creates the correct srsName', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new Feature({
|
||||
const format = new WFS();
|
||||
const insertFeature = new Feature({
|
||||
the_geom: new MultiLineString([[
|
||||
[-5178372.1885436, 1992365.7775042],
|
||||
[-4434792.7774889, 1601008.1927386],
|
||||
@@ -721,8 +721,8 @@ describe('ol.format.WFS', function() {
|
||||
TYPE: 'xyz'
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var serialized = format.writeTransaction(inserts, null, null, {
|
||||
const inserts = [insertFeature];
|
||||
const serialized = format.writeTransaction(inserts, null, null, {
|
||||
featureNS: 'http://foo',
|
||||
featureType: 'FAULTS',
|
||||
featurePrefix: 'feature',
|
||||
@@ -733,7 +733,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
describe('when writing out a Transaction request', function() {
|
||||
var text;
|
||||
let text;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wfs/TransactionUpdate.xml', function(xml) {
|
||||
text = xml;
|
||||
@@ -742,8 +742,8 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates the correct update', function() {
|
||||
var format = new WFS();
|
||||
var updateFeature = new Feature();
|
||||
const format = new WFS();
|
||||
const updateFeature = new Feature();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new MultiLineString([[
|
||||
[-12279454, 6741885],
|
||||
@@ -753,7 +753,7 @@ describe('ol.format.WFS', function() {
|
||||
[-12416429, 6604910]
|
||||
]]));
|
||||
updateFeature.setId('FAULTS.4455');
|
||||
var serialized = format.writeTransaction(null, [updateFeature], null, {
|
||||
const serialized = format.writeTransaction(null, [updateFeature], null, {
|
||||
featureNS: 'http://foo',
|
||||
featureType: 'FAULTS',
|
||||
featurePrefix: 'foo',
|
||||
@@ -763,8 +763,8 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates the correct update if geometry name is alias', function() {
|
||||
var format = new WFS();
|
||||
var updateFeature = new Feature(new MultiLineString([[
|
||||
const format = new WFS();
|
||||
const updateFeature = new Feature(new MultiLineString([[
|
||||
[-12279454, 6741885],
|
||||
[-12064207, 6732101],
|
||||
[-11941908, 6595126],
|
||||
@@ -773,7 +773,7 @@ describe('ol.format.WFS', function() {
|
||||
]]));
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setId('FAULTS.4455');
|
||||
var serialized = format.writeTransaction(null, [updateFeature], null, {
|
||||
const serialized = format.writeTransaction(null, [updateFeature], null, {
|
||||
featureNS: 'http://foo',
|
||||
featureType: 'FAULTS',
|
||||
featurePrefix: 'foo',
|
||||
@@ -787,8 +787,8 @@ describe('ol.format.WFS', function() {
|
||||
describe('when writing out a Transaction request', function() {
|
||||
|
||||
it('creates the correct update with default featurePrefix', function() {
|
||||
var format = new WFS();
|
||||
var updateFeature = new Feature();
|
||||
const format = new WFS();
|
||||
const updateFeature = new Feature();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new MultiLineString([[
|
||||
[-12279454, 6741885],
|
||||
@@ -798,7 +798,7 @@ describe('ol.format.WFS', function() {
|
||||
[-12416429, 6604910]
|
||||
]]));
|
||||
updateFeature.setId('FAULTS.4455');
|
||||
var serialized = format.writeTransaction(null, [updateFeature], null, {
|
||||
const serialized = format.writeTransaction(null, [updateFeature], null, {
|
||||
featureNS: 'http://foo',
|
||||
featureType: 'FAULTS',
|
||||
gmlOptions: {srsName: 'EPSG:900913'}
|
||||
@@ -810,8 +810,8 @@ describe('ol.format.WFS', function() {
|
||||
describe('when writing out a Transaction request', function() {
|
||||
|
||||
it('does not create an update if no fid', function() {
|
||||
var format = new WFS();
|
||||
var updateFeature = new Feature();
|
||||
const format = new WFS();
|
||||
const updateFeature = new Feature();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new MultiLineString([[
|
||||
[-12279454, 6741885],
|
||||
@@ -833,7 +833,8 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
describe('when writing out a Transaction request', function() {
|
||||
var text, filename = 'spec/ol/format/wfs/TransactionUpdateMultiGeoms.xml';
|
||||
let text;
|
||||
const filename = 'spec/ol/format/wfs/TransactionUpdateMultiGeoms.xml';
|
||||
before(function(done) {
|
||||
afterLoadText(filename, function(xml) {
|
||||
text = xml;
|
||||
@@ -843,8 +844,8 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles multiple geometries', function() {
|
||||
var format = new WFS();
|
||||
var updateFeature = new Feature();
|
||||
const format = new WFS();
|
||||
const updateFeature = new Feature();
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setGeometry(new MultiLineString([[
|
||||
[-12279454, 6741885],
|
||||
@@ -858,7 +859,7 @@ describe('ol.format.WFS', function() {
|
||||
[-12000001, 6700001],
|
||||
[-12000002, 6700002]
|
||||
]]));
|
||||
var serialized = format.writeTransaction([updateFeature], [], null, {
|
||||
const serialized = format.writeTransaction([updateFeature], [], null, {
|
||||
featureNS: 'http://foo',
|
||||
featureType: 'FAULTS',
|
||||
featurePrefix: 'foo',
|
||||
@@ -869,7 +870,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
describe('when writing out a Transaction request', function() {
|
||||
var text;
|
||||
let text;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wfs/TransactionMulti.xml', function(xml) {
|
||||
text = xml;
|
||||
@@ -878,15 +879,15 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('creates the correct transaction body', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new Feature({
|
||||
const format = new WFS();
|
||||
const insertFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new Feature({
|
||||
const inserts = [insertFeature];
|
||||
const updateFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
@@ -896,12 +897,12 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
updateFeature.setId('fid.42');
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
var updates = [updateFeature];
|
||||
const updates = [updateFeature];
|
||||
|
||||
var deleteFeature = new Feature();
|
||||
const deleteFeature = new Feature();
|
||||
deleteFeature.setId('fid.37');
|
||||
var deletes = [deleteFeature];
|
||||
var serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
const deletes = [deleteFeature];
|
||||
const serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featureType: 'states',
|
||||
featurePrefix: 'topp'
|
||||
@@ -912,7 +913,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
describe('when writing out a Transaction request', function() {
|
||||
var text;
|
||||
let text;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wfs/Native.xml', function(xml) {
|
||||
text = xml;
|
||||
@@ -921,8 +922,8 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles writing out Native', function() {
|
||||
var format = new WFS();
|
||||
var serialized = format.writeTransaction(null, null, null, {
|
||||
const format = new WFS();
|
||||
const serialized = format.writeTransaction(null, null, null, {
|
||||
nativeElements: [{
|
||||
vendorId: 'ORACLE',
|
||||
safeToIgnore: true,
|
||||
@@ -938,8 +939,8 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
describe('when writing out a Transaction request', function() {
|
||||
var text;
|
||||
var filename = 'spec/ol/format/wfs/TransactionMultiVersion100.xml';
|
||||
let text;
|
||||
const filename = 'spec/ol/format/wfs/TransactionMultiVersion100.xml';
|
||||
before(function(done) {
|
||||
afterLoadText(filename, function(xml) {
|
||||
text = xml;
|
||||
@@ -948,15 +949,15 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles the WFS version', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new Feature({
|
||||
const format = new WFS();
|
||||
const insertFeature = new Feature({
|
||||
the_geom: new LineString([[1.1, 2], [3, 4.2]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new Feature({
|
||||
const inserts = [insertFeature];
|
||||
const updateFeature = new Feature({
|
||||
the_geom: new LineString([[1.1, 2], [3, 4.2]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
@@ -966,12 +967,12 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
updateFeature.setId('fid.42');
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
var updates = [updateFeature];
|
||||
const updates = [updateFeature];
|
||||
|
||||
var deleteFeature = new Feature();
|
||||
const deleteFeature = new Feature();
|
||||
deleteFeature.setId('fid.37');
|
||||
var deletes = [deleteFeature];
|
||||
var serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
const deletes = [deleteFeature];
|
||||
const serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featureType: 'states',
|
||||
featurePrefix: 'topp',
|
||||
@@ -983,7 +984,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
describe('when writing out a Transaction request', function() {
|
||||
var text;
|
||||
let text;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wfs/TransactionMulti.xml', function(xml) {
|
||||
text = xml;
|
||||
@@ -992,15 +993,15 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('do not add feature prefix twice', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new Feature({
|
||||
const format = new WFS();
|
||||
const insertFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new Feature({
|
||||
const inserts = [insertFeature];
|
||||
const updateFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
@@ -1010,12 +1011,12 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
updateFeature.setId('fid.42');
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
var updates = [updateFeature];
|
||||
const updates = [updateFeature];
|
||||
|
||||
var deleteFeature = new Feature();
|
||||
const deleteFeature = new Feature();
|
||||
deleteFeature.setId('fid.37');
|
||||
var deletes = [deleteFeature];
|
||||
var serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
const deletes = [deleteFeature];
|
||||
const serialized = format.writeTransaction(inserts, updates, deletes, {
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featureType: 'topp:states',
|
||||
featurePrefix: 'topp'
|
||||
@@ -1025,8 +1026,8 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
describe('when writing out a transaction request', function() {
|
||||
var text;
|
||||
var filename = 'spec/ol/format/wfs/TransactionMultiVersion100_3D.xml';
|
||||
let text;
|
||||
const filename = 'spec/ol/format/wfs/TransactionMultiVersion100_3D.xml';
|
||||
before(function(done) {
|
||||
afterLoadText(filename, function(xml) {
|
||||
text = xml;
|
||||
@@ -1035,15 +1036,15 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles 3D in WFS 1.0.0', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new Feature({
|
||||
const format = new WFS();
|
||||
const insertFeature = new Feature({
|
||||
the_geom: new LineString([[1.1, 2, 4], [3, 4.2, 5]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new Feature({
|
||||
const inserts = [insertFeature];
|
||||
const updateFeature = new Feature({
|
||||
the_geom: new LineString([[1.1, 2, 6], [3, 4.2, 7]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
@@ -1053,9 +1054,9 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setId('fid.42');
|
||||
var updates = [updateFeature];
|
||||
const updates = [updateFeature];
|
||||
|
||||
var serialized = format.writeTransaction(inserts, updates, null, {
|
||||
const serialized = format.writeTransaction(inserts, updates, null, {
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featureType: 'states',
|
||||
featurePrefix: 'topp',
|
||||
@@ -1068,7 +1069,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
describe('when writing out a Transaction request', function() {
|
||||
var text;
|
||||
let text;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wfs/TransactionMulti_3D.xml', function(xml) {
|
||||
text = xml;
|
||||
@@ -1077,15 +1078,15 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles 3D in WFS 1.1.0', function() {
|
||||
var format = new WFS();
|
||||
var insertFeature = new Feature({
|
||||
const format = new WFS();
|
||||
const insertFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2, 3]]),
|
||||
foo: 'bar',
|
||||
nul: null
|
||||
});
|
||||
insertFeature.setGeometryName('the_geom');
|
||||
var inserts = [insertFeature];
|
||||
var updateFeature = new Feature({
|
||||
const inserts = [insertFeature];
|
||||
const updateFeature = new Feature({
|
||||
the_geom: new MultiPoint([[1, 2, 3]]),
|
||||
foo: 'bar',
|
||||
// null value gets Property element with no Value
|
||||
@@ -1095,9 +1096,9 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
updateFeature.setGeometryName('the_geom');
|
||||
updateFeature.setId('fid.42');
|
||||
var updates = [updateFeature];
|
||||
const updates = [updateFeature];
|
||||
|
||||
var serialized = format.writeTransaction(inserts, updates, null, {
|
||||
const serialized = format.writeTransaction(inserts, updates, null, {
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featureType: 'states',
|
||||
hasZ: true,
|
||||
@@ -1108,7 +1109,7 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
describe('when writing out a GetFeature request', function() {
|
||||
var text;
|
||||
let text;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wfs/GetFeatureMultiple.xml', function(xml) {
|
||||
text = xml;
|
||||
@@ -1117,8 +1118,8 @@ describe('ol.format.WFS', function() {
|
||||
});
|
||||
|
||||
it('handles writing multiple Query elements', function() {
|
||||
var format = new WFS();
|
||||
var serialized = format.writeGetFeature({
|
||||
const format = new WFS();
|
||||
const serialized = format.writeGetFeature({
|
||||
featureNS: 'http://www.openplans.org/topp',
|
||||
featureTypes: ['states', 'cities'],
|
||||
featurePrefix: 'topp'
|
||||
@@ -1129,11 +1130,11 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
describe('when parsing GML from MapServer', function() {
|
||||
|
||||
var features, feature;
|
||||
let features, feature;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wfs/mapserver.xml', function(xml) {
|
||||
try {
|
||||
var config = {
|
||||
const config = {
|
||||
'featureNS': 'http://mapserver.gis.umn.edu/mapserver',
|
||||
'featureType': 'Historische_Messtischblaetter_WFS'
|
||||
};
|
||||
@@ -1151,7 +1152,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
it('creates a polygon for Arnstadt', function() {
|
||||
feature = features[0];
|
||||
var fid = 'Historische_Messtischblaetter_WFS.71055885';
|
||||
const fid = 'Historische_Messtischblaetter_WFS.71055885';
|
||||
expect(feature.getId()).to.equal(fid);
|
||||
expect(feature.get('titel')).to.equal('Arnstadt');
|
||||
expect(feature.getGeometry()).to.be.an(Polygon);
|
||||
@@ -1161,7 +1162,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
describe('when parsing multiple feature types', function() {
|
||||
|
||||
var features;
|
||||
let features;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) {
|
||||
try {
|
||||
@@ -1184,7 +1185,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
describe('when parsing multiple feature types separately', function() {
|
||||
|
||||
var lineFeatures, polygonFeatures;
|
||||
let lineFeatures, polygonFeatures;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) {
|
||||
try {
|
||||
@@ -1212,7 +1213,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
describe('when parsing multiple feature types', function() {
|
||||
|
||||
var features;
|
||||
let features;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames.xml', function(xml) {
|
||||
try {
|
||||
@@ -1232,7 +1233,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
describe('when parsing multiple feature types (MapServer)', function() {
|
||||
|
||||
var features;
|
||||
let features;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) {
|
||||
try {
|
||||
@@ -1255,7 +1256,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
describe('when parsing multiple feature types separately (MapServer)', function() {
|
||||
|
||||
var busFeatures, infoFeatures;
|
||||
let busFeatures, infoFeatures;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/gml/multiple-typenames-mapserver.xml', function(xml) {
|
||||
try {
|
||||
@@ -1283,7 +1284,7 @@ describe('ol.format.WFS', function() {
|
||||
|
||||
describe('when writing out a WFS Filter', function() {
|
||||
it('creates a filter', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<Filter xmlns="http://www.opengis.net/ogc">' +
|
||||
' <And>' +
|
||||
' <PropertyIsLike wildCard="*" singleChar="." escapeChar="!">' +
|
||||
@@ -1296,11 +1297,11 @@ describe('ol.format.WFS', function() {
|
||||
' </PropertyIsEqualTo>' +
|
||||
' </And>' +
|
||||
'</Filter>';
|
||||
var serialized = WFS.writeFilter(
|
||||
_ol_format_filter_.and(
|
||||
_ol_format_filter_.like('name', 'Mississippi*'),
|
||||
_ol_format_filter_.equalTo('waterway', 'riverbank')
|
||||
)
|
||||
const serialized = WFS.writeFilter(
|
||||
_ol_format_filter_.and(
|
||||
_ol_format_filter_.like('name', 'Mississippi*'),
|
||||
_ol_format_filter_.equalTo('waterway', 'riverbank')
|
||||
)
|
||||
);
|
||||
expect(serialized).to.xmleql(_ol_xml_.parse(text));
|
||||
});
|
||||
|
||||
+179
-179
@@ -6,11 +6,11 @@ import {transform} from '../../../../src/ol/proj.js';
|
||||
|
||||
describe('ol.format.WKT', function() {
|
||||
|
||||
var format = new WKT();
|
||||
let format = new WKT();
|
||||
|
||||
describe('#readProjectionFromText', function() {
|
||||
it('returns the default projection', function() {
|
||||
var projection = format.readProjectionFromText('POINT(1 2)');
|
||||
const projection = format.readProjectionFromText('POINT(1 2)');
|
||||
expect(projection).to.be(null);
|
||||
});
|
||||
});
|
||||
@@ -18,13 +18,13 @@ describe('ol.format.WKT', function() {
|
||||
describe('#readGeometry()', function() {
|
||||
|
||||
it('transforms with dataProjection and featureProjection', function() {
|
||||
var wkt = 'POINT(1 2)';
|
||||
var geom = format.readGeometry(wkt, {
|
||||
const wkt = 'POINT(1 2)';
|
||||
const geom = format.readGeometry(wkt, {
|
||||
dataProjection: 'EPSG:4326',
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(geom.getCoordinates()).to.eql(
|
||||
transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -32,12 +32,12 @@ describe('ol.format.WKT', function() {
|
||||
describe('#writeGeometry()', function() {
|
||||
|
||||
it('transforms with dataProjection and featureProjection', function() {
|
||||
var geom = new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857');
|
||||
var wkt = format.writeGeometry(geom, {
|
||||
const geom = new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857');
|
||||
const wkt = format.writeGeometry(geom, {
|
||||
dataProjection: 'EPSG:4326',
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
var got = format.readGeometry(wkt).getCoordinates();
|
||||
const got = format.readGeometry(wkt).getCoordinates();
|
||||
expect(got[0]).to.roughlyEqual(1, 1e-6);
|
||||
expect(got[1]).to.roughlyEqual(2, 1e-6);
|
||||
});
|
||||
@@ -47,14 +47,14 @@ describe('ol.format.WKT', function() {
|
||||
describe('#readFeature()', function() {
|
||||
|
||||
it('transforms with dataProjection and featureProjection', function() {
|
||||
var wkt = 'POINT(1 2)';
|
||||
var feature = format.readFeature(wkt, {
|
||||
const wkt = 'POINT(1 2)';
|
||||
const feature = format.readFeature(wkt, {
|
||||
dataProjection: 'EPSG:4326',
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
var geom = feature.getGeometry();
|
||||
const geom = feature.getGeometry();
|
||||
expect(geom.getCoordinates()).to.eql(
|
||||
transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
|
||||
});
|
||||
@@ -62,15 +62,15 @@ describe('ol.format.WKT', function() {
|
||||
describe('#writeFeature()', function() {
|
||||
|
||||
it('transforms with dataProjection and featureProjection', function() {
|
||||
var feature = new Feature(
|
||||
new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857'));
|
||||
var wkt = format.writeFeature(feature, {
|
||||
const feature = new Feature(
|
||||
new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857'));
|
||||
const wkt = format.writeFeature(feature, {
|
||||
dataProjection: 'EPSG:4326',
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
var gotFeature = format.readFeature(wkt);
|
||||
const gotFeature = format.readFeature(wkt);
|
||||
expect(gotFeature).to.be.a(Feature);
|
||||
var got = gotFeature.getGeometry().getCoordinates();
|
||||
const got = gotFeature.getGeometry().getCoordinates();
|
||||
expect(got[0]).to.roughlyEqual(1, 1e-6);
|
||||
expect(got[1]).to.roughlyEqual(2, 1e-6);
|
||||
});
|
||||
@@ -80,54 +80,54 @@ describe('ol.format.WKT', function() {
|
||||
describe('#readFeatures()', function() {
|
||||
|
||||
it('transforms with dataProjection and featureProjection', function() {
|
||||
var wkt = 'GEOMETRYCOLLECTION(POINT(1 2),POINT(4 5))';
|
||||
var features = format.readFeatures(wkt, {
|
||||
const wkt = 'GEOMETRYCOLLECTION(POINT(1 2),POINT(4 5))';
|
||||
const features = format.readFeatures(wkt, {
|
||||
dataProjection: 'EPSG:4326',
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
expect(features.length).to.eql(2);
|
||||
var point1 = features[0].getGeometry();
|
||||
var point2 = features[1].getGeometry();
|
||||
const point1 = features[0].getGeometry();
|
||||
const point2 = features[1].getGeometry();
|
||||
expect(point1.getType()).to.eql('Point');
|
||||
expect(point2.getType()).to.eql('Point');
|
||||
expect(point1.getCoordinates()).to.eql(
|
||||
transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([1, 2], 'EPSG:4326', 'EPSG:3857'));
|
||||
expect(point2.getCoordinates()).to.eql(
|
||||
transform([4, 5], 'EPSG:4326', 'EPSG:3857'));
|
||||
transform([4, 5], 'EPSG:4326', 'EPSG:3857'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('#writeFeatures()', function() {
|
||||
|
||||
it('transforms with dataProjection and featureProjection', function() {
|
||||
var features = [
|
||||
const features = [
|
||||
new Feature(
|
||||
new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857')),
|
||||
new Point([1, 2]).transform('EPSG:4326', 'EPSG:3857')),
|
||||
new Feature(
|
||||
new Point([4, 5]).transform('EPSG:4326', 'EPSG:3857'))
|
||||
new Point([4, 5]).transform('EPSG:4326', 'EPSG:3857'))
|
||||
];
|
||||
var wkt = format.writeFeatures(features, {
|
||||
const wkt = format.writeFeatures(features, {
|
||||
dataProjection: 'EPSG:4326',
|
||||
featureProjection: 'EPSG:3857'
|
||||
});
|
||||
var gotFeatures = format.readFeatures(wkt);
|
||||
const gotFeatures = format.readFeatures(wkt);
|
||||
expect(gotFeatures).to.have.length(2);
|
||||
expect(gotFeatures[0].getGeometry().getCoordinates()[0])
|
||||
.to.roughlyEqual(1, 1e-6);
|
||||
.to.roughlyEqual(1, 1e-6);
|
||||
expect(gotFeatures[0].getGeometry().getCoordinates()[1])
|
||||
.to.roughlyEqual(2, 1e-6);
|
||||
.to.roughlyEqual(2, 1e-6);
|
||||
expect(gotFeatures[1].getGeometry().getCoordinates()[0])
|
||||
.to.roughlyEqual(4, 1e-6);
|
||||
.to.roughlyEqual(4, 1e-6);
|
||||
expect(gotFeatures[1].getGeometry().getCoordinates()[1])
|
||||
.to.roughlyEqual(5, 1e-6);
|
||||
.to.roughlyEqual(5, 1e-6);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
it('Point read / written correctly', function() {
|
||||
var wkt = 'POINT(30 10)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'POINT(30 10)';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getCoordinates()).to.eql([30, 10]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
// test whitespace when reading
|
||||
@@ -137,8 +137,8 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('Point Z read / written correctly', function() {
|
||||
var wkt = 'POINT Z(30 10 5)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'POINT Z(30 10 5)';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getCoordinates()).to.eql([30, 10, 5]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
// test whitespace when reading
|
||||
@@ -148,8 +148,8 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('Point M read / written correctly', function() {
|
||||
var wkt = 'POINT M(30 10 5)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'POINT M(30 10 5)';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getCoordinates()).to.eql([30, 10, 5]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
// test whitespace when reading
|
||||
@@ -159,8 +159,8 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('Point ZM read / written correctly', function() {
|
||||
var wkt = 'POINT ZM(30 10 5 0.1)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'POINT ZM(30 10 5 0.1)';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getCoordinates()).to.eql([30, 10, 5, 0.1]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
// test whitespace when reading
|
||||
@@ -171,9 +171,9 @@ describe('ol.format.WKT', function() {
|
||||
|
||||
it('MultiPoint read / written correctly', function() {
|
||||
// there are two forms to test
|
||||
var wkt = 'MULTIPOINT((10 40),(40 30),(20 20),(30 10))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
var points = geom.getPoints();
|
||||
let wkt = 'MULTIPOINT((10 40),(40 30),(20 20),(30 10))';
|
||||
let geom = format.readGeometry(wkt);
|
||||
let points = geom.getPoints();
|
||||
expect(points.length).to.eql(4);
|
||||
expect(points[0].getCoordinates()).to.eql([10, 40]);
|
||||
expect(points[1].getCoordinates()).to.eql([40, 30]);
|
||||
@@ -193,9 +193,9 @@ describe('ol.format.WKT', function() {
|
||||
|
||||
it('MultiPoint Z read / written correctly', function() {
|
||||
// there are two forms to test
|
||||
var wkt = 'MULTIPOINT Z((10 40 1),(40 30 2),(20 20 3),(30 10 4))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
var points = geom.getPoints();
|
||||
let wkt = 'MULTIPOINT Z((10 40 1),(40 30 2),(20 20 3),(30 10 4))';
|
||||
let geom = format.readGeometry(wkt);
|
||||
let points = geom.getPoints();
|
||||
expect(points.length).to.eql(4);
|
||||
expect(points[0].getCoordinates()).to.eql([10, 40, 1]);
|
||||
expect(points[1].getCoordinates()).to.eql([40, 30, 2]);
|
||||
@@ -215,9 +215,9 @@ describe('ol.format.WKT', function() {
|
||||
|
||||
it('MultiPoint M read / written correctly', function() {
|
||||
// there are two forms to test
|
||||
var wkt = 'MULTIPOINT M((10 40 1),(40 30 2),(20 20 3),(30 10 4))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
var points = geom.getPoints();
|
||||
let wkt = 'MULTIPOINT M((10 40 1),(40 30 2),(20 20 3),(30 10 4))';
|
||||
let geom = format.readGeometry(wkt);
|
||||
let points = geom.getPoints();
|
||||
expect(points.length).to.eql(4);
|
||||
expect(points[0].getCoordinates()).to.eql([10, 40, 1]);
|
||||
expect(points[1].getCoordinates()).to.eql([40, 30, 2]);
|
||||
@@ -237,9 +237,9 @@ describe('ol.format.WKT', function() {
|
||||
|
||||
it('MultiPoint ZM read / written correctly', function() {
|
||||
// there are two forms to test
|
||||
var wkt = 'MULTIPOINT ZM((10 40 1 0.1),(40 30 2 0.1),(20 20 3 0.1),(30 10 4 0.1))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
var points = geom.getPoints();
|
||||
let wkt = 'MULTIPOINT ZM((10 40 1 0.1),(40 30 2 0.1),(20 20 3 0.1),(30 10 4 0.1))';
|
||||
let geom = format.readGeometry(wkt);
|
||||
let points = geom.getPoints();
|
||||
expect(points.length).to.eql(4);
|
||||
expect(points[0].getCoordinates()).to.eql([10, 40, 1, 0.1]);
|
||||
expect(points[1].getCoordinates()).to.eql([40, 30, 2, 0.1]);
|
||||
@@ -258,8 +258,8 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('LineString read / written correctly', function() {
|
||||
var wkt = 'LINESTRING(30 10,10 30,40 40)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'LINESTRING(30 10,10 30,40 40)';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
expect(geom.getCoordinates()).to.eql([[30, 10], [10, 30], [40, 40]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
@@ -271,8 +271,8 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('LineString Z read / written correctly', function() {
|
||||
var wkt = 'LINESTRING Z(30 10 1,10 30 2,40 40 3)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'LINESTRING Z(30 10 1,10 30 2,40 40 3)';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
expect(geom.getCoordinates()).to.eql([[30, 10, 1], [10, 30, 2], [40, 40, 3]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
@@ -284,8 +284,8 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('LineString M read / written correctly', function() {
|
||||
var wkt = 'LINESTRING M(30 10 1,10 30 2,40 40 3)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'LINESTRING M(30 10 1,10 30 2,40 40 3)';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
expect(geom.getCoordinates()).to.eql([[30, 10, 1], [10, 30, 2], [40, 40, 3]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
@@ -297,8 +297,8 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('LineString ZM read / written correctly', function() {
|
||||
var wkt = 'LINESTRING ZM(30 10 1 0.1,10 30 2 0.1,40 40 3 0.1)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'LINESTRING ZM(30 10 1 0.1,10 30 2 0.1,40 40 3 0.1)';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('LineString');
|
||||
expect(geom.getCoordinates()).to.eql([[30, 10, 1, 0.1], [10, 30, 2, 0.1], [40, 40, 3, 0.1]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
@@ -310,15 +310,15 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('MultiLineString read / written correctly', function() {
|
||||
var wkt = 'MULTILINESTRING((10 10,20 20,10 40),' +
|
||||
let wkt = 'MULTILINESTRING((10 10,20 20,10 40),' +
|
||||
'(40 40,30 30,40 20,30 10))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('MultiLineString');
|
||||
var linestrings = geom.getLineStrings();
|
||||
let linestrings = geom.getLineStrings();
|
||||
expect(linestrings.length).to.eql(2);
|
||||
expect(linestrings[0].getType()).to.eql('LineString');
|
||||
expect(linestrings[0].getCoordinates()).to.eql(
|
||||
[[10, 10], [20, 20], [10, 40]]);
|
||||
[[10, 10], [20, 20], [10, 40]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
// test whitespace when reading
|
||||
wkt = 'MULTILINESTRING ( (10 10, 20 20, 10 40), ' +
|
||||
@@ -328,21 +328,21 @@ describe('ol.format.WKT', function() {
|
||||
linestrings = geom.getLineStrings();
|
||||
expect(linestrings.length).to.eql(2);
|
||||
expect(linestrings[0].getType()).to.eql(
|
||||
'LineString');
|
||||
'LineString');
|
||||
expect(linestrings[0].getCoordinates()).to.eql(
|
||||
[[10, 10], [20, 20], [10, 40]]);
|
||||
[[10, 10], [20, 20], [10, 40]]);
|
||||
});
|
||||
|
||||
it('MultiLineString Z read / written correctly', function() {
|
||||
var wkt = 'MULTILINESTRING Z((10 10 1,20 20 2,10 40 3),' +
|
||||
let wkt = 'MULTILINESTRING Z((10 10 1,20 20 2,10 40 3),' +
|
||||
'(40 40 1,30 30 2,40 20 3,30 10 4))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('MultiLineString');
|
||||
var linestrings = geom.getLineStrings();
|
||||
let linestrings = geom.getLineStrings();
|
||||
expect(linestrings.length).to.eql(2);
|
||||
expect(linestrings[0].getType()).to.eql('LineString');
|
||||
expect(linestrings[0].getCoordinates()).to.eql(
|
||||
[[10, 10, 1], [20, 20, 2], [10, 40, 3]]);
|
||||
[[10, 10, 1], [20, 20, 2], [10, 40, 3]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
// test whitespace when reading
|
||||
wkt = 'MULTILINESTRING Z ( (10 10 1, 20 20 2, 10 40 3), ' +
|
||||
@@ -352,21 +352,21 @@ describe('ol.format.WKT', function() {
|
||||
linestrings = geom.getLineStrings();
|
||||
expect(linestrings.length).to.eql(2);
|
||||
expect(linestrings[0].getType()).to.eql(
|
||||
'LineString');
|
||||
'LineString');
|
||||
expect(linestrings[0].getCoordinates()).to.eql(
|
||||
[[10, 10, 1], [20, 20, 2], [10, 40, 3]]);
|
||||
[[10, 10, 1], [20, 20, 2], [10, 40, 3]]);
|
||||
});
|
||||
|
||||
it('MultiLineString M read / written correctly', function() {
|
||||
var wkt = 'MULTILINESTRING M((10 10 1,20 20 2,10 40 3),' +
|
||||
let wkt = 'MULTILINESTRING M((10 10 1,20 20 2,10 40 3),' +
|
||||
'(40 40 1,30 30 2,40 20 3,30 10 4))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('MultiLineString');
|
||||
var linestrings = geom.getLineStrings();
|
||||
let linestrings = geom.getLineStrings();
|
||||
expect(linestrings.length).to.eql(2);
|
||||
expect(linestrings[0].getType()).to.eql('LineString');
|
||||
expect(linestrings[0].getCoordinates()).to.eql(
|
||||
[[10, 10, 1], [20, 20, 2], [10, 40, 3]]);
|
||||
[[10, 10, 1], [20, 20, 2], [10, 40, 3]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
// test whitespace when reading
|
||||
wkt = 'MULTILINESTRING M ( (10 10 1, 20 20 2, 10 40 3), ' +
|
||||
@@ -376,21 +376,21 @@ describe('ol.format.WKT', function() {
|
||||
linestrings = geom.getLineStrings();
|
||||
expect(linestrings.length).to.eql(2);
|
||||
expect(linestrings[0].getType()).to.eql(
|
||||
'LineString');
|
||||
'LineString');
|
||||
expect(linestrings[0].getCoordinates()).to.eql(
|
||||
[[10, 10, 1], [20, 20, 2], [10, 40, 3]]);
|
||||
[[10, 10, 1], [20, 20, 2], [10, 40, 3]]);
|
||||
});
|
||||
|
||||
it('MultiLineString ZM read / written correctly', function() {
|
||||
var wkt = 'MULTILINESTRING ZM((10 10 1 0.1,20 20 2 0.1,10 40 3 0.1),' +
|
||||
let wkt = 'MULTILINESTRING ZM((10 10 1 0.1,20 20 2 0.1,10 40 3 0.1),' +
|
||||
'(40 40 1 0.1,30 30 2 0.1,40 20 3 0.1,30 10 4 0.1))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('MultiLineString');
|
||||
var linestrings = geom.getLineStrings();
|
||||
let linestrings = geom.getLineStrings();
|
||||
expect(linestrings.length).to.eql(2);
|
||||
expect(linestrings[0].getType()).to.eql('LineString');
|
||||
expect(linestrings[0].getCoordinates()).to.eql(
|
||||
[[10, 10, 1, 0.1], [20, 20, 2, 0.1], [10, 40, 3, 0.1]]);
|
||||
[[10, 10, 1, 0.1], [20, 20, 2, 0.1], [10, 40, 3, 0.1]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
// test whitespace when reading
|
||||
wkt = 'MULTILINESTRING ZM ( (10 10 1 0.1, 20 20 2 0.1, 10 40 3 0.1), ' +
|
||||
@@ -400,20 +400,20 @@ describe('ol.format.WKT', function() {
|
||||
linestrings = geom.getLineStrings();
|
||||
expect(linestrings.length).to.eql(2);
|
||||
expect(linestrings[0].getType()).to.eql(
|
||||
'LineString');
|
||||
'LineString');
|
||||
expect(linestrings[0].getCoordinates()).to.eql(
|
||||
[[10, 10, 1, 0.1], [20, 20, 2, 0.1], [10, 40, 3, 0.1]]);
|
||||
[[10, 10, 1, 0.1], [20, 20, 2, 0.1], [10, 40, 3, 0.1]]);
|
||||
});
|
||||
|
||||
it('Polygon read / written correctly', function() {
|
||||
var wkt = 'POLYGON((30 10,10 20,20 40,40 40,30 10))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'POLYGON((30 10,10 20,20 40,40 40,30 10))';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('Polygon');
|
||||
var rings = geom.getLinearRings();
|
||||
let rings = geom.getLinearRings();
|
||||
expect(rings.length).to.eql(1);
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[30, 10], [10, 20], [20, 40], [40, 40], [30, 10]]);
|
||||
[[30, 10], [10, 20], [20, 40], [40, 40], [30, 10]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// note that WKT doesn't care about winding order, we do
|
||||
@@ -425,9 +425,9 @@ describe('ol.format.WKT', function() {
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[1].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[35, 10], [10, 20], [15, 40], [45, 45], [35, 10]]);
|
||||
[[35, 10], [10, 20], [15, 40], [45, 45], [35, 10]]);
|
||||
expect(rings[1].getCoordinates()).to.eql(
|
||||
[[20, 30], [30, 20], [35, 35], [20, 30]]);
|
||||
[[20, 30], [30, 20], [35, 35], [20, 30]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// test whitespace when reading
|
||||
@@ -438,18 +438,18 @@ describe('ol.format.WKT', function() {
|
||||
expect(rings.length).to.eql(1);
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[30, 10], [10, 20], [20, 40], [40, 40], [30, 10]]);
|
||||
[[30, 10], [10, 20], [20, 40], [40, 40], [30, 10]]);
|
||||
});
|
||||
|
||||
it('Polygon Z read / written correctly', function() {
|
||||
var wkt = 'POLYGON Z((30 10 1,10 20 2,20 40 3,40 40 4,30 10 1))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'POLYGON Z((30 10 1,10 20 2,20 40 3,40 40 4,30 10 1))';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('Polygon');
|
||||
var rings = geom.getLinearRings();
|
||||
let rings = geom.getLinearRings();
|
||||
expect(rings.length).to.eql(1);
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[30, 10, 1], [10, 20, 2], [20, 40, 3], [40, 40, 4], [30, 10, 1]]);
|
||||
[[30, 10, 1], [10, 20, 2], [20, 40, 3], [40, 40, 4], [30, 10, 1]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// note that WKT doesn't care about winding order, we do
|
||||
@@ -461,9 +461,9 @@ describe('ol.format.WKT', function() {
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[1].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[35, 10, 1], [10, 20, 2], [15, 40, 3], [45, 45, 4], [35, 10, 1]]);
|
||||
[[35, 10, 1], [10, 20, 2], [15, 40, 3], [45, 45, 4], [35, 10, 1]]);
|
||||
expect(rings[1].getCoordinates()).to.eql(
|
||||
[[20, 30, 1], [30, 20, 2], [35, 35, 3], [20, 30, 1]]);
|
||||
[[20, 30, 1], [30, 20, 2], [35, 35, 3], [20, 30, 1]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// test whitespace when reading
|
||||
@@ -474,18 +474,18 @@ describe('ol.format.WKT', function() {
|
||||
expect(rings.length).to.eql(1);
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[30, 10, 1], [10, 20, 2], [20, 40, 3], [40, 40, 4], [30, 10, 1]]);
|
||||
[[30, 10, 1], [10, 20, 2], [20, 40, 3], [40, 40, 4], [30, 10, 1]]);
|
||||
});
|
||||
|
||||
it('Polygon M read / written correctly', function() {
|
||||
var wkt = 'POLYGON M((30 10 1,10 20 2,20 40 3,40 40 4,30 10 1))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'POLYGON M((30 10 1,10 20 2,20 40 3,40 40 4,30 10 1))';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('Polygon');
|
||||
var rings = geom.getLinearRings();
|
||||
let rings = geom.getLinearRings();
|
||||
expect(rings.length).to.eql(1);
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[30, 10, 1], [10, 20, 2], [20, 40, 3], [40, 40, 4], [30, 10, 1]]);
|
||||
[[30, 10, 1], [10, 20, 2], [20, 40, 3], [40, 40, 4], [30, 10, 1]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// note that WKT doesn't care about winding order, we do
|
||||
@@ -497,9 +497,9 @@ describe('ol.format.WKT', function() {
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[1].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[35, 10, 1], [10, 20, 2], [15, 40, 3], [45, 45, 4], [35, 10, 1]]);
|
||||
[[35, 10, 1], [10, 20, 2], [15, 40, 3], [45, 45, 4], [35, 10, 1]]);
|
||||
expect(rings[1].getCoordinates()).to.eql(
|
||||
[[20, 30, 1], [30, 20, 2], [35, 35, 3], [20, 30, 1]]);
|
||||
[[20, 30, 1], [30, 20, 2], [35, 35, 3], [20, 30, 1]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// test whitespace when reading
|
||||
@@ -510,18 +510,18 @@ describe('ol.format.WKT', function() {
|
||||
expect(rings.length).to.eql(1);
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[30, 10, 1], [10, 20, 2], [20, 40, 3], [40, 40, 4], [30, 10, 1]]);
|
||||
[[30, 10, 1], [10, 20, 2], [20, 40, 3], [40, 40, 4], [30, 10, 1]]);
|
||||
});
|
||||
|
||||
it('Polygon ZM read / written correctly', function() {
|
||||
var wkt = 'POLYGON ZM((30 10 1 0.1,10 20 2 0.1,20 40 3 0.1,40 40 4 0.1,30 10 1 0.1))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let wkt = 'POLYGON ZM((30 10 1 0.1,10 20 2 0.1,20 40 3 0.1,40 40 4 0.1,30 10 1 0.1))';
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('Polygon');
|
||||
var rings = geom.getLinearRings();
|
||||
let rings = geom.getLinearRings();
|
||||
expect(rings.length).to.eql(1);
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[30, 10, 1, 0.1], [10, 20, 2, 0.1], [20, 40, 3, 0.1], [40, 40, 4, 0.1], [30, 10, 1, 0.1]]);
|
||||
[[30, 10, 1, 0.1], [10, 20, 2, 0.1], [20, 40, 3, 0.1], [40, 40, 4, 0.1], [30, 10, 1, 0.1]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// note that WKT doesn't care about winding order, we do
|
||||
@@ -533,9 +533,9 @@ describe('ol.format.WKT', function() {
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[1].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[35, 10, 1, 0.1], [10, 20, 2, 0.1], [15, 40, 3, 0.1], [45, 45, 4, 0.1], [35, 10, 1, 0.1]]);
|
||||
[[35, 10, 1, 0.1], [10, 20, 2, 0.1], [15, 40, 3, 0.1], [45, 45, 4, 0.1], [35, 10, 1, 0.1]]);
|
||||
expect(rings[1].getCoordinates()).to.eql(
|
||||
[[20, 30, 1, 0.1], [30, 20, 2, 0.1], [35, 35, 3, 0.1], [20, 30, 1, 0.1]]);
|
||||
[[20, 30, 1, 0.1], [30, 20, 2, 0.1], [35, 35, 3, 0.1], [20, 30, 1, 0.1]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// test whitespace when reading
|
||||
@@ -546,27 +546,27 @@ describe('ol.format.WKT', function() {
|
||||
expect(rings.length).to.eql(1);
|
||||
expect(rings[0].getType()).to.eql('LinearRing');
|
||||
expect(rings[0].getCoordinates()).to.eql(
|
||||
[[30, 10, 1, 0.1], [10, 20, 2, 0.1], [20, 40, 3, 0.1], [40, 40, 4, 0.1], [30, 10, 1, 0.1]]);
|
||||
[[30, 10, 1, 0.1], [10, 20, 2, 0.1], [20, 40, 3, 0.1], [40, 40, 4, 0.1], [30, 10, 1, 0.1]]);
|
||||
});
|
||||
|
||||
it('MultiPolygon read / written correctly', function() {
|
||||
// note that WKT doesn't care about winding order, we do
|
||||
var wkt = 'MULTIPOLYGON(((40 40,45 30,20 45,40 40)),' +
|
||||
let wkt = 'MULTIPOLYGON(((40 40,45 30,20 45,40 40)),' +
|
||||
'((20 35,45 20,30 5,10 10,10 30,20 35),(30 20,20 25,20 15,30 20)))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('MultiPolygon');
|
||||
var polygons = geom.getPolygons();
|
||||
let polygons = geom.getPolygons();
|
||||
expect(polygons.length).to.eql(2);
|
||||
expect(polygons[0].getType()).to.eql('Polygon');
|
||||
expect(polygons[1].getType()).to.eql('Polygon');
|
||||
expect(polygons[0].getLinearRings().length).to.eql(1);
|
||||
expect(polygons[1].getLinearRings().length).to.eql(2);
|
||||
expect(polygons[0].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[40, 40], [45, 30], [20, 45], [40, 40]]);
|
||||
[[40, 40], [45, 30], [20, 45], [40, 40]]);
|
||||
expect(polygons[1].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[20, 35], [45, 20], [30, 5], [10, 10], [10, 30], [20, 35]]);
|
||||
[[20, 35], [45, 20], [30, 5], [10, 10], [10, 30], [20, 35]]);
|
||||
expect(polygons[1].getLinearRings()[1].getCoordinates()).to.eql(
|
||||
[[30, 20], [20, 25], [20, 15], [30, 20]]);
|
||||
[[30, 20], [20, 25], [20, 15], [30, 20]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// test whitespace when reading
|
||||
@@ -582,31 +582,31 @@ describe('ol.format.WKT', function() {
|
||||
expect(polygons[0].getLinearRings().length).to.eql(1);
|
||||
expect(polygons[1].getLinearRings().length).to.eql(2);
|
||||
expect(polygons[0].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[40, 40], [45, 30], [20, 45], [40, 40]]);
|
||||
[[40, 40], [45, 30], [20, 45], [40, 40]]);
|
||||
expect(polygons[1].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[20, 35], [45, 20], [30, 5], [10, 10], [10, 30], [20, 35]]);
|
||||
[[20, 35], [45, 20], [30, 5], [10, 10], [10, 30], [20, 35]]);
|
||||
expect(polygons[1].getLinearRings()[1].getCoordinates()).to.eql(
|
||||
[[30, 20], [20, 25], [20, 15], [30, 20]]);
|
||||
[[30, 20], [20, 25], [20, 15], [30, 20]]);
|
||||
});
|
||||
|
||||
it('MultiPolygon Z read / written correctly', function() {
|
||||
// note that WKT doesn't care about winding order, we do
|
||||
var wkt = 'MULTIPOLYGON Z(((40 40 1,45 30 2,20 45 3,40 40 1)),' +
|
||||
let wkt = 'MULTIPOLYGON Z(((40 40 1,45 30 2,20 45 3,40 40 1)),' +
|
||||
'((20 35 1,45 20 2,30 5 3,10 10 4,10 30 5,20 35 1),(30 20 1,20 25 2,20 15 3,30 20 1)))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('MultiPolygon');
|
||||
var polygons = geom.getPolygons();
|
||||
let polygons = geom.getPolygons();
|
||||
expect(polygons.length).to.eql(2);
|
||||
expect(polygons[0].getType()).to.eql('Polygon');
|
||||
expect(polygons[1].getType()).to.eql('Polygon');
|
||||
expect(polygons[0].getLinearRings().length).to.eql(1);
|
||||
expect(polygons[1].getLinearRings().length).to.eql(2);
|
||||
expect(polygons[0].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[40, 40, 1], [45, 30, 2], [20, 45, 3], [40, 40, 1]]);
|
||||
[[40, 40, 1], [45, 30, 2], [20, 45, 3], [40, 40, 1]]);
|
||||
expect(polygons[1].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[20, 35, 1], [45, 20, 2], [30, 5, 3], [10, 10, 4], [10, 30, 5], [20, 35, 1]]);
|
||||
[[20, 35, 1], [45, 20, 2], [30, 5, 3], [10, 10, 4], [10, 30, 5], [20, 35, 1]]);
|
||||
expect(polygons[1].getLinearRings()[1].getCoordinates()).to.eql(
|
||||
[[30, 20, 1], [20, 25, 2], [20, 15, 3], [30, 20, 1]]);
|
||||
[[30, 20, 1], [20, 25, 2], [20, 15, 3], [30, 20, 1]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// test whitespace when reading
|
||||
@@ -622,31 +622,31 @@ describe('ol.format.WKT', function() {
|
||||
expect(polygons[0].getLinearRings().length).to.eql(1);
|
||||
expect(polygons[1].getLinearRings().length).to.eql(2);
|
||||
expect(polygons[0].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[40, 40, 1], [45, 30, 2], [20, 45, 3], [40, 40, 1]]);
|
||||
[[40, 40, 1], [45, 30, 2], [20, 45, 3], [40, 40, 1]]);
|
||||
expect(polygons[1].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[20, 35, 1], [45, 20, 2], [30, 5, 3], [10, 10, 4], [10, 30, 5], [20, 35, 1]]);
|
||||
[[20, 35, 1], [45, 20, 2], [30, 5, 3], [10, 10, 4], [10, 30, 5], [20, 35, 1]]);
|
||||
expect(polygons[1].getLinearRings()[1].getCoordinates()).to.eql(
|
||||
[[30, 20, 1], [20, 25, 2], [20, 15, 3], [30, 20, 1]]);
|
||||
[[30, 20, 1], [20, 25, 2], [20, 15, 3], [30, 20, 1]]);
|
||||
});
|
||||
|
||||
it('MultiPolygon M read / written correctly', function() {
|
||||
// note that WKT doesn't care about winding order, we do
|
||||
var wkt = 'MULTIPOLYGON M(((40 40 1,45 30 2,20 45 3,40 40 1)),' +
|
||||
let wkt = 'MULTIPOLYGON M(((40 40 1,45 30 2,20 45 3,40 40 1)),' +
|
||||
'((20 35 1,45 20 2,30 5 3,10 10 4,10 30 5,20 35 1),(30 20 1,20 25 2,20 15 3,30 20 1)))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('MultiPolygon');
|
||||
var polygons = geom.getPolygons();
|
||||
let polygons = geom.getPolygons();
|
||||
expect(polygons.length).to.eql(2);
|
||||
expect(polygons[0].getType()).to.eql('Polygon');
|
||||
expect(polygons[1].getType()).to.eql('Polygon');
|
||||
expect(polygons[0].getLinearRings().length).to.eql(1);
|
||||
expect(polygons[1].getLinearRings().length).to.eql(2);
|
||||
expect(polygons[0].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[40, 40, 1], [45, 30, 2], [20, 45, 3], [40, 40, 1]]);
|
||||
[[40, 40, 1], [45, 30, 2], [20, 45, 3], [40, 40, 1]]);
|
||||
expect(polygons[1].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[20, 35, 1], [45, 20, 2], [30, 5, 3], [10, 10, 4], [10, 30, 5], [20, 35, 1]]);
|
||||
[[20, 35, 1], [45, 20, 2], [30, 5, 3], [10, 10, 4], [10, 30, 5], [20, 35, 1]]);
|
||||
expect(polygons[1].getLinearRings()[1].getCoordinates()).to.eql(
|
||||
[[30, 20, 1], [20, 25, 2], [20, 15, 3], [30, 20, 1]]);
|
||||
[[30, 20, 1], [20, 25, 2], [20, 15, 3], [30, 20, 1]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// test whitespace when reading
|
||||
@@ -662,31 +662,31 @@ describe('ol.format.WKT', function() {
|
||||
expect(polygons[0].getLinearRings().length).to.eql(1);
|
||||
expect(polygons[1].getLinearRings().length).to.eql(2);
|
||||
expect(polygons[0].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[40, 40, 1], [45, 30, 2], [20, 45, 3], [40, 40, 1]]);
|
||||
[[40, 40, 1], [45, 30, 2], [20, 45, 3], [40, 40, 1]]);
|
||||
expect(polygons[1].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[20, 35, 1], [45, 20, 2], [30, 5, 3], [10, 10, 4], [10, 30, 5], [20, 35, 1]]);
|
||||
[[20, 35, 1], [45, 20, 2], [30, 5, 3], [10, 10, 4], [10, 30, 5], [20, 35, 1]]);
|
||||
expect(polygons[1].getLinearRings()[1].getCoordinates()).to.eql(
|
||||
[[30, 20, 1], [20, 25, 2], [20, 15, 3], [30, 20, 1]]);
|
||||
[[30, 20, 1], [20, 25, 2], [20, 15, 3], [30, 20, 1]]);
|
||||
});
|
||||
|
||||
it('MultiPolygon ZM read / written correctly', function() {
|
||||
// note that WKT doesn't care about winding order, we do
|
||||
var wkt = 'MULTIPOLYGON ZM(((40 40 1 0.1,45 30 2 0.1,20 45 3 0.1,40 40 1 0.1)),' +
|
||||
let wkt = 'MULTIPOLYGON ZM(((40 40 1 0.1,45 30 2 0.1,20 45 3 0.1,40 40 1 0.1)),' +
|
||||
'((20 35 1 0.1,45 20 2 0.1,30 5 3 0.1,10 10 4 0.1,10 30 5 0.1,20 35 1 0.1),(30 20 1 0.1,20 25 2 0.1,20 15 3 0.1,30 20 1 0.1)))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
let geom = format.readGeometry(wkt);
|
||||
expect(geom.getType()).to.eql('MultiPolygon');
|
||||
var polygons = geom.getPolygons();
|
||||
let polygons = geom.getPolygons();
|
||||
expect(polygons.length).to.eql(2);
|
||||
expect(polygons[0].getType()).to.eql('Polygon');
|
||||
expect(polygons[1].getType()).to.eql('Polygon');
|
||||
expect(polygons[0].getLinearRings().length).to.eql(1);
|
||||
expect(polygons[1].getLinearRings().length).to.eql(2);
|
||||
expect(polygons[0].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[40, 40, 1, 0.1], [45, 30, 2, 0.1], [20, 45, 3, 0.1], [40, 40, 1, 0.1]]);
|
||||
[[40, 40, 1, 0.1], [45, 30, 2, 0.1], [20, 45, 3, 0.1], [40, 40, 1, 0.1]]);
|
||||
expect(polygons[1].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[20, 35, 1, 0.1], [45, 20, 2, 0.1], [30, 5, 3, 0.1], [10, 10, 4, 0.1], [10, 30, 5, 0.1], [20, 35, 1, 0.1]]);
|
||||
[[20, 35, 1, 0.1], [45, 20, 2, 0.1], [30, 5, 3, 0.1], [10, 10, 4, 0.1], [10, 30, 5, 0.1], [20, 35, 1, 0.1]]);
|
||||
expect(polygons[1].getLinearRings()[1].getCoordinates()).to.eql(
|
||||
[[30, 20, 1, 0.1], [20, 25, 2, 0.1], [20, 15, 3, 0.1], [30, 20, 1, 0.1]]);
|
||||
[[30, 20, 1, 0.1], [20, 25, 2, 0.1], [20, 15, 3, 0.1], [30, 20, 1, 0.1]]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
|
||||
// test whitespace when reading
|
||||
@@ -702,20 +702,20 @@ describe('ol.format.WKT', function() {
|
||||
expect(polygons[0].getLinearRings().length).to.eql(1);
|
||||
expect(polygons[1].getLinearRings().length).to.eql(2);
|
||||
expect(polygons[0].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[40, 40, 1, 0.1], [45, 30, 2, 0.1], [20, 45, 3, 0.1], [40, 40, 1, 0.1]]);
|
||||
[[40, 40, 1, 0.1], [45, 30, 2, 0.1], [20, 45, 3, 0.1], [40, 40, 1, 0.1]]);
|
||||
expect(polygons[1].getLinearRings()[0].getCoordinates()).to.eql(
|
||||
[[20, 35, 1, 0.1], [45, 20, 2, 0.1], [30, 5, 3, 0.1], [10, 10, 4, 0.1], [10, 30, 5, 0.1], [20, 35, 1, 0.1]]);
|
||||
[[20, 35, 1, 0.1], [45, 20, 2, 0.1], [30, 5, 3, 0.1], [10, 10, 4, 0.1], [10, 30, 5, 0.1], [20, 35, 1, 0.1]]);
|
||||
expect(polygons[1].getLinearRings()[1].getCoordinates()).to.eql(
|
||||
[[30, 20, 1, 0.1], [20, 25, 2, 0.1], [20, 15, 3, 0.1], [30, 20, 1, 0.1]]);
|
||||
[[30, 20, 1, 0.1], [20, 25, 2, 0.1], [20, 15, 3, 0.1], [30, 20, 1, 0.1]]);
|
||||
});
|
||||
|
||||
it('Empty geometries read / written correctly', function() {
|
||||
var wkts = [
|
||||
const wkts = [
|
||||
'POINT', 'LINESTRING', 'POLYGON', 'MULTIPOINT', 'MULTILINESTRING', 'MULTIPOLYGON'
|
||||
];
|
||||
for (var i = 0, ii = wkts.length; i < ii; ++i) {
|
||||
var wkt = wkts[i] + ' EMPTY';
|
||||
var geom = format.readGeometry(wkt);
|
||||
for (let i = 0, ii = wkts.length; i < ii; ++i) {
|
||||
const wkt = wkts[i] + ' EMPTY';
|
||||
const geom = format.readGeometry(wkt);
|
||||
expect(geom.getCoordinates()).to.eql([]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
}
|
||||
@@ -749,9 +749,9 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('GeometryCollection read / written correctly', function() {
|
||||
var wkt = 'GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))';
|
||||
var geom = format.readGeometry(wkt);
|
||||
var geoms = geom.getGeometries();
|
||||
let wkt = 'GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))';
|
||||
let geom = format.readGeometry(wkt);
|
||||
let geoms = geom.getGeometries();
|
||||
expect(geoms.length).to.eql(2);
|
||||
expect(geom.getType()).to.eql('GeometryCollection');
|
||||
expect(geoms[0].getType()).to.eql('Point');
|
||||
@@ -772,18 +772,18 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('Empty GeometryCollection read / written correctly', function() {
|
||||
var wkt = 'GEOMETRYCOLLECTION EMPTY';
|
||||
var geom = format.readGeometry(wkt);
|
||||
const wkt = 'GEOMETRYCOLLECTION EMPTY';
|
||||
const geom = format.readGeometry(wkt);
|
||||
expect(geom.getGeometries()).to.eql([]);
|
||||
expect(format.writeGeometry(geom)).to.eql(wkt);
|
||||
});
|
||||
|
||||
it('GeometryCollection split / merged correctly', function() {
|
||||
format = new WKT({splitCollection: true});
|
||||
var wkt = 'GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))';
|
||||
var features = format.readFeatures(wkt);
|
||||
const wkt = 'GEOMETRYCOLLECTION(POINT(4 6),LINESTRING(4 6,7 10))';
|
||||
const features = format.readFeatures(wkt);
|
||||
expect(features.length).to.eql(2);
|
||||
var geoms = [features[0].getGeometry(), features[1].getGeometry()];
|
||||
const geoms = [features[0].getGeometry(), features[1].getGeometry()];
|
||||
expect(geoms[0].getType()).to.eql('Point');
|
||||
expect(geoms[1].getType()).to.eql('LineString');
|
||||
expect(geoms[0].getCoordinates()).to.eql([4, 6]);
|
||||
@@ -792,19 +792,19 @@ describe('ol.format.WKT', function() {
|
||||
});
|
||||
|
||||
it('Point feature read / written correctly', function() {
|
||||
var wkt = 'POINT(30 10)';
|
||||
var feature = format.readFeature(wkt);
|
||||
var geom = feature.getGeometry();
|
||||
const wkt = 'POINT(30 10)';
|
||||
const feature = format.readFeature(wkt);
|
||||
const geom = feature.getGeometry();
|
||||
expect(geom.getCoordinates()).to.eql([30, 10]);
|
||||
expect(format.writeFeature(feature)).to.eql(wkt);
|
||||
});
|
||||
|
||||
it('Features read / written correctly', function() {
|
||||
var wkt = 'GEOMETRYCOLLECTION(POINT(1 2),POINT(3 4))';
|
||||
var features = format.readFeatures(wkt);
|
||||
const wkt = 'GEOMETRYCOLLECTION(POINT(1 2),POINT(3 4))';
|
||||
const features = format.readFeatures(wkt);
|
||||
expect(features.length).to.eql(2);
|
||||
var point1 = features[0].getGeometry();
|
||||
var point2 = features[1].getGeometry();
|
||||
const point1 = features[0].getGeometry();
|
||||
const point2 = features[1].getGeometry();
|
||||
expect(point1.getType()).to.eql('Point');
|
||||
expect(point2.getType()).to.eql('Point');
|
||||
expect(point1.getCoordinates()).to.eql([1, 2]);
|
||||
@@ -815,22 +815,22 @@ describe('ol.format.WKT', function() {
|
||||
describe('scientific notation supported', function() {
|
||||
|
||||
it('handles scientific notation correctly', function() {
|
||||
var wkt = 'POINT(3e1 1e1)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
const wkt = 'POINT(3e1 1e1)';
|
||||
const geom = format.readGeometry(wkt);
|
||||
expect(geom.getCoordinates()).to.eql([30, 10]);
|
||||
expect(format.writeGeometry(geom)).to.eql('POINT(30 10)');
|
||||
});
|
||||
|
||||
it('works with with negative exponent', function() {
|
||||
var wkt = 'POINT(3e-1 1e-1)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
const wkt = 'POINT(3e-1 1e-1)';
|
||||
const geom = format.readGeometry(wkt);
|
||||
expect(geom.getCoordinates()).to.eql([0.3, 0.1]);
|
||||
expect(format.writeGeometry(geom)).to.eql('POINT(0.3 0.1)');
|
||||
});
|
||||
|
||||
it('works with with explicitly positive exponent', function() {
|
||||
var wkt = 'POINT(3e+1 1e+1)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
const wkt = 'POINT(3e+1 1e+1)';
|
||||
const geom = format.readGeometry(wkt);
|
||||
expect(geom.getCoordinates()).to.eql([30, 10]);
|
||||
expect(format.writeGeometry(geom)).to.eql('POINT(30 10)');
|
||||
});
|
||||
@@ -838,8 +838,8 @@ describe('ol.format.WKT', function() {
|
||||
it('handles very small numbers in scientific notation', function() {
|
||||
// very small numbers keep the scientific notation, both when reading and
|
||||
// writing
|
||||
var wkt = 'POINT(3e-9 1e-9)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
const wkt = 'POINT(3e-9 1e-9)';
|
||||
const geom = format.readGeometry(wkt);
|
||||
expect(geom.getCoordinates()).to.eql([3e-9, 1e-9]);
|
||||
expect(format.writeGeometry(geom)).to.eql('POINT(3e-9 1e-9)');
|
||||
});
|
||||
@@ -847,15 +847,15 @@ describe('ol.format.WKT', function() {
|
||||
it('handles very big numbers in scientific notation', function() {
|
||||
// very big numbers keep the scientific notation, both when reading and
|
||||
// writing
|
||||
var wkt = 'POINT(3e25 1e25)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
const wkt = 'POINT(3e25 1e25)';
|
||||
const geom = format.readGeometry(wkt);
|
||||
expect(geom.getCoordinates()).to.eql([3e25, 1e25]);
|
||||
expect(format.writeGeometry(geom)).to.eql('POINT(3e+25 1e+25)');
|
||||
});
|
||||
|
||||
it('works case insensitively (e / E)', function() {
|
||||
var wkt = 'POINT(3E1 1E1)';
|
||||
var geom = format.readGeometry(wkt);
|
||||
const wkt = 'POINT(3E1 1E1)';
|
||||
const geom = format.readGeometry(wkt);
|
||||
expect(geom.getCoordinates()).to.eql([30, 10]);
|
||||
expect(format.writeGeometry(geom)).to.eql('POINT(30 10)');
|
||||
});
|
||||
|
||||
@@ -4,8 +4,8 @@ describe('ol.format.WMSCapabilities', function() {
|
||||
|
||||
describe('when parsing ogcsample.xml', function() {
|
||||
|
||||
var parser = new WMSCapabilities();
|
||||
var capabilities;
|
||||
const parser = new WMSCapabilities();
|
||||
let capabilities;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wms/ogcsample.xml', function(xml) {
|
||||
try {
|
||||
@@ -23,8 +23,8 @@ describe('ol.format.WMSCapabilities', function() {
|
||||
|
||||
it('can read Service section', function() {
|
||||
// FIXME not all fields are tested
|
||||
var service = capabilities.Service;
|
||||
var contact = service.ContactInformation;
|
||||
const service = capabilities.Service;
|
||||
const contact = service.ContactInformation;
|
||||
|
||||
expect(service.Name).to.eql('WMS');
|
||||
expect(service.Title).to.eql('Acme Corp. Map Server');
|
||||
@@ -44,42 +44,42 @@ describe('ol.format.WMSCapabilities', function() {
|
||||
});
|
||||
|
||||
it('can read Capability.Exception', function() {
|
||||
var exception = capabilities.Capability.Exception;
|
||||
const exception = capabilities.Capability.Exception;
|
||||
|
||||
expect(exception).to.eql(['XML', 'INIMAGE', 'BLANK']);
|
||||
});
|
||||
|
||||
it('can read Capability.Request.GetCapabilities', function() {
|
||||
var getCapabilities = capabilities.Capability.Request.GetCapabilities;
|
||||
const getCapabilities = capabilities.Capability.Request.GetCapabilities;
|
||||
|
||||
expect(getCapabilities.Format).to.eql(['text/xml']);
|
||||
expect(getCapabilities.DCPType.length).to.eql(1);
|
||||
var http = getCapabilities.DCPType[0].HTTP;
|
||||
const http = getCapabilities.DCPType[0].HTTP;
|
||||
expect(http.Get.OnlineResource).to.eql('http://hostname/path?');
|
||||
expect(http.Post.OnlineResource).to.eql('http://hostname/path?');
|
||||
});
|
||||
|
||||
it('can read Capability.Request.GetFeatureInfo', function() {
|
||||
var getFeatureInfo = capabilities.Capability.Request.GetFeatureInfo;
|
||||
const getFeatureInfo = capabilities.Capability.Request.GetFeatureInfo;
|
||||
|
||||
expect(getFeatureInfo.Format).to.eql(
|
||||
['text/xml', 'text/plain', 'text/html']);
|
||||
['text/xml', 'text/plain', 'text/html']);
|
||||
expect(getFeatureInfo.DCPType.length).to.eql(1);
|
||||
var http = getFeatureInfo.DCPType[0].HTTP;
|
||||
const http = getFeatureInfo.DCPType[0].HTTP;
|
||||
expect(http.Get.OnlineResource).to.eql('http://hostname/path?');
|
||||
});
|
||||
|
||||
it('can read Capability.Request.GetMap', function() {
|
||||
var getMap = capabilities.Capability.Request.GetMap;
|
||||
const getMap = capabilities.Capability.Request.GetMap;
|
||||
|
||||
expect(getMap.Format).to.eql(['image/gif', 'image/png', 'image/jpeg']);
|
||||
expect(getMap.DCPType.length).to.eql(1);
|
||||
var http = getMap.DCPType[0].HTTP;
|
||||
const http = getMap.DCPType[0].HTTP;
|
||||
expect(http.Get.OnlineResource).to.eql('http://hostname/path?');
|
||||
});
|
||||
|
||||
it('can read Capability.Layer', function() {
|
||||
var layer = capabilities.Capability.Layer;
|
||||
const layer = capabilities.Capability.Layer;
|
||||
|
||||
expect(layer.Title).to.eql('Acme Corp. Map Server');
|
||||
expect(layer.Name).to.be(undefined);
|
||||
@@ -109,7 +109,7 @@ describe('ol.format.WMSCapabilities', function() {
|
||||
res: [1, 1]
|
||||
}]);
|
||||
expect(layer.Layer[0].EX_GeographicBoundingBox).to.eql(
|
||||
[-71.63, 41.75, -70.78, 42.9]);
|
||||
[-71.63, 41.75, -70.78, 42.9]);
|
||||
expect(layer.Layer[0].Style).to.eql([{
|
||||
Name: 'USGS',
|
||||
Title: 'USGS Topo Map Style',
|
||||
|
||||
@@ -8,12 +8,12 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
describe('#getLayers', function() {
|
||||
|
||||
it('returns null if layers is undefined', function() {
|
||||
var format = new WMSGetFeatureInfo();
|
||||
const format = new WMSGetFeatureInfo();
|
||||
expect(format.getLayers()).to.be(null);
|
||||
});
|
||||
|
||||
it('returns the value provided in the layers option', function() {
|
||||
var format = new WMSGetFeatureInfo({
|
||||
const format = new WMSGetFeatureInfo({
|
||||
layers: ['a', 'z']
|
||||
});
|
||||
expect(format.getLayers()).to.eql(['a', 'z']);
|
||||
@@ -25,7 +25,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
|
||||
describe('read Features', function() {
|
||||
|
||||
var features;
|
||||
let features;
|
||||
|
||||
before(function(done) {
|
||||
proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326'));
|
||||
@@ -51,34 +51,34 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
});
|
||||
|
||||
it('creates a feature for 1071', function() {
|
||||
var feature = features[0];
|
||||
const feature = features[0];
|
||||
expect(feature.getId()).to.be(undefined);
|
||||
expect(feature.get('FID')).to.equal('1071');
|
||||
expect(feature.get('NO_CAMPAGNE')).to.equal('1020050');
|
||||
});
|
||||
|
||||
it('read boundedBy but no geometry', function() {
|
||||
var feature = features[0];
|
||||
const feature = features[0];
|
||||
expect(feature.getGeometry()).to.be(undefined);
|
||||
expect(feature.get('boundedBy')).to.eql(
|
||||
[-531138.686422, 5386348.414671, -117252.819653, 6144475.186022]);
|
||||
[-531138.686422, 5386348.414671, -117252.819653, 6144475.186022]);
|
||||
});
|
||||
|
||||
it('read empty response', function() {
|
||||
// read empty response
|
||||
var text = '<?xml version="1.0" encoding="ISO-8859-1"?>' +
|
||||
const text = '<?xml version="1.0" encoding="ISO-8859-1"?>' +
|
||||
'<msGMLOutput xmlns:gml="http://www.opengis.net/gml"' +
|
||||
' xmlns:xlink="http://www.w3.org/1999/xlink"' +
|
||||
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' +
|
||||
' <AAA64_layer>' +
|
||||
' </AAA64_layer>' +
|
||||
'</msGMLOutput>';
|
||||
var features = new WMSGetFeatureInfo().readFeatures(text);
|
||||
const features = new WMSGetFeatureInfo().readFeatures(text);
|
||||
expect(features.length).to.be(0);
|
||||
});
|
||||
|
||||
it('read empty attributes', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<?xml version="1.0" encoding="ISO-8859-1"?>' +
|
||||
'<msGMLOutput ' +
|
||||
' xmlns:gml="http://www.opengis.net/gml"' +
|
||||
@@ -98,7 +98,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
' </AAA64_feature>' +
|
||||
' </AAA64_layer>' +
|
||||
'</msGMLOutput>';
|
||||
var features = new WMSGetFeatureInfo().readFeatures(text);
|
||||
const features = new WMSGetFeatureInfo().readFeatures(text);
|
||||
expect(features.length).to.be(1);
|
||||
expect(features[0].get('FOO')).to.be('bar');
|
||||
// FIXME is that really wanted ?
|
||||
@@ -106,7 +106,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
});
|
||||
|
||||
it('read features from multiple layers', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<?xml version="1.0" encoding="ISO-8859-1"?>' +
|
||||
'<msGMLOutput ' +
|
||||
' xmlns:gml="http://www.opengis.net/gml"' +
|
||||
@@ -158,24 +158,24 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
' </AAA62_feature>' +
|
||||
' </AAA62_layer>' +
|
||||
'</msGMLOutput>';
|
||||
var format = new WMSGetFeatureInfo();
|
||||
var features = format.readFeatures(text);
|
||||
const format = new WMSGetFeatureInfo();
|
||||
const features = format.readFeatures(text);
|
||||
expect(features.length).to.be(2);
|
||||
expect(features[0].get('OBJECTID')).to.be('287');
|
||||
expect(features[1].get('OBJECTID')).to.be('1251');
|
||||
format.setLayers(['AAA64']);
|
||||
var aaa64Features = format.readFeatures(text);
|
||||
const aaa64Features = format.readFeatures(text);
|
||||
expect(aaa64Features.length).to.be(1);
|
||||
format.setLayers(['AAA64', 'AAA62']);
|
||||
var allFeatures = format.readFeatures(text);
|
||||
const allFeatures = format.readFeatures(text);
|
||||
expect(allFeatures.length).to.be(2);
|
||||
format.setLayers(['foo', 'bar']);
|
||||
var dummyFeatures = format.readFeatures(text);
|
||||
const dummyFeatures = format.readFeatures(text);
|
||||
expect(dummyFeatures.length).to.be(0);
|
||||
});
|
||||
|
||||
it('read geoserver’s response', function() {
|
||||
var text =
|
||||
const text =
|
||||
'<?xml version="1.0" encoding="UTF-8"?>' +
|
||||
'<wfs:FeatureCollection xmlns="http://www.opengis.net/wfs"' +
|
||||
' xmlns:wfs="http://www.opengis.net/wfs"' +
|
||||
@@ -224,7 +224,7 @@ describe('ol.format.WMSGetFeatureInfo', function() {
|
||||
' </opengeo:roads>' +
|
||||
' </gml:featureMember>' +
|
||||
'</wfs:FeatureCollection>';
|
||||
var features = new WMSGetFeatureInfo().readFeatures(text);
|
||||
const features = new WMSGetFeatureInfo().readFeatures(text);
|
||||
expect(features.length).to.be(1);
|
||||
expect(features[0].get('cat')).to.be('3');
|
||||
expect(features[0].getGeometry().getType()).to.be('MultiLineString');
|
||||
|
||||
@@ -5,8 +5,8 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
|
||||
describe('when parsing ogcsample.xml', function() {
|
||||
|
||||
var parser = new _ol_format_WMTSCapabilities_();
|
||||
var capabilities;
|
||||
const parser = new _ol_format_WMTSCapabilities_();
|
||||
let capabilities;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wmts/ogcsample.xml', function(xml) {
|
||||
try {
|
||||
@@ -24,9 +24,9 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
expect(capabilities.Contents.Layer).to.have.length(1);
|
||||
|
||||
|
||||
var layer = capabilities.Contents.Layer[0];
|
||||
const layer = capabilities.Contents.Layer[0];
|
||||
expect(layer.Abstract).to.be
|
||||
.eql('Blue Marble Next Generation NASA Product');
|
||||
.eql('Blue Marble Next Generation NASA Product');
|
||||
expect(layer.Identifier).to.be.eql('BlueMarbleNextGeneration');
|
||||
expect(layer.Title).to.be.eql('Blue Marble Next Generation');
|
||||
|
||||
@@ -49,18 +49,18 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
expect(layer.Style[0].isDefault).to.be(true);
|
||||
expect(layer.Style[0].Title).to.be.eql('Dark Blue');
|
||||
expect(layer.Style[0].LegendURL[0].href).to.be
|
||||
.eql('http://www.miramon.uab.es/wmts/Coastlines/' +
|
||||
.eql('http://www.miramon.uab.es/wmts/Coastlines/' +
|
||||
'coastlines_darkBlue.png');
|
||||
expect(layer.Style[0].LegendURL[0].format).to.be.eql('image/png');
|
||||
|
||||
expect(layer.TileMatrixSetLink).to.be.an('array');
|
||||
expect(layer.TileMatrixSetLink).to.have.length(2);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSet).to.be
|
||||
.eql('BigWorldPixel');
|
||||
.eql('BigWorldPixel');
|
||||
expect(layer.TileMatrixSetLink[1].TileMatrixSet).to.be
|
||||
.eql('google3857');
|
||||
.eql('google3857');
|
||||
|
||||
var wgs84Bbox = layer.WGS84BoundingBox;
|
||||
const wgs84Bbox = layer.WGS84BoundingBox;
|
||||
expect(wgs84Bbox).to.be.an('array');
|
||||
expect(wgs84Bbox[0]).to.be.eql(-180);
|
||||
expect(wgs84Bbox[2]).to.be.eql(180);
|
||||
@@ -71,7 +71,7 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
expect(layer.ResourceURL).to.have.length(2);
|
||||
expect(layer.ResourceURL[0].format).to.be.eql('image/png');
|
||||
expect(layer.ResourceURL[0].template).to.be
|
||||
.eql('http://www.example.com/wmts/coastlines/{TileMatrix}' +
|
||||
.eql('http://www.example.com/wmts/coastlines/{TileMatrix}' +
|
||||
'/{TileRow}/{TileCol}.png');
|
||||
|
||||
});
|
||||
@@ -79,7 +79,7 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
it('Can read Capabilities.Content.TileMatrixSet', function() {
|
||||
expect(capabilities.Contents.TileMatrixSet).to.be.ok();
|
||||
|
||||
var bigWorld = capabilities.Contents.TileMatrixSet[2];
|
||||
const bigWorld = capabilities.Contents.TileMatrixSet[2];
|
||||
expect(bigWorld).to.be.ok();
|
||||
expect(bigWorld.Identifier).to.be.eql('BigWorld');
|
||||
expect(bigWorld.SupportedCRS).to.be.eql('urn:ogc:def:crs:OGC:1.3:CRS84');
|
||||
@@ -116,8 +116,8 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
|
||||
describe('when parsing ign.xml', function() {
|
||||
|
||||
var parser = new _ol_format_WMTSCapabilities_();
|
||||
var capabilities;
|
||||
const parser = new _ol_format_WMTSCapabilities_();
|
||||
let capabilities;
|
||||
before(function(done) {
|
||||
afterLoadText('spec/ol/format/wmts/ign.xml', function(xml) {
|
||||
try {
|
||||
@@ -134,30 +134,30 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
expect(capabilities.Contents.Layer).to.have.length(1);
|
||||
|
||||
|
||||
var layer = capabilities.Contents.Layer[0];
|
||||
const layer = capabilities.Contents.Layer[0];
|
||||
expect(layer.TileMatrixSetLink).to.be.an('array');
|
||||
expect(layer.TileMatrixSetLink).to.have.length(1);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSet).to.be
|
||||
.eql('PM');
|
||||
.eql('PM');
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits).to.be.an('array');
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits).to.have.length(20);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].TileMatrix)
|
||||
.to.be.eql('0');
|
||||
.to.be.eql('0');
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MinTileRow)
|
||||
.to.be.eql(0);
|
||||
.to.be.eql(0);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MaxTileRow)
|
||||
.to.be.eql(1);
|
||||
.to.be.eql(1);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MinTileCol)
|
||||
.to.be.eql(0);
|
||||
.to.be.eql(0);
|
||||
expect(layer.TileMatrixSetLink[0].TileMatrixSetLimits[0].MaxTileCol)
|
||||
.to.be.eql(1);
|
||||
.to.be.eql(1);
|
||||
|
||||
});
|
||||
|
||||
it('Can read Capabilities.Content.TileMatrixSet', function() {
|
||||
expect(capabilities.Contents.TileMatrixSet).to.be.ok();
|
||||
|
||||
var pm = capabilities.Contents.TileMatrixSet[0];
|
||||
const pm = capabilities.Contents.TileMatrixSet[0];
|
||||
expect(pm).to.be.ok();
|
||||
expect(pm.Identifier).to.be.eql('PM');
|
||||
expect(pm.SupportedCRS).to.be.eql('EPSG:3857');
|
||||
@@ -166,7 +166,7 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
expect(pm.TileMatrix[0].MatrixHeight).to.be.eql(1);
|
||||
expect(pm.TileMatrix[0].MatrixWidth).to.be.eql(1);
|
||||
expect(pm.TileMatrix[0].ScaleDenominator)
|
||||
.to.be.eql(559082264.0287178958533332);
|
||||
.to.be.eql(559082264.0287178958533332);
|
||||
expect(pm.TileMatrix[0].TileWidth).to.be.eql(256);
|
||||
expect(pm.TileMatrix[0].TileHeight).to.be.eql(256);
|
||||
expect(pm.TileMatrix[0].TopLeftCorner).to.be.a('array');
|
||||
@@ -176,7 +176,7 @@ describe('ol.format.WMTSCapabilities', function() {
|
||||
expect(pm.TileMatrix[1].MatrixHeight).to.be.eql(2);
|
||||
expect(pm.TileMatrix[1].MatrixWidth).to.be.eql(2);
|
||||
expect(pm.TileMatrix[1].ScaleDenominator)
|
||||
.to.be.eql(279541132.0143588959472254);
|
||||
.to.be.eql(279541132.0143588959472254);
|
||||
expect(pm.TileMatrix[1].TileWidth).to.be.eql(256);
|
||||
expect(pm.TileMatrix[1].TileHeight).to.be.eql(256);
|
||||
expect(pm.TileMatrix[1].TopLeftCorner).to.be.a('array');
|
||||
|
||||
@@ -5,7 +5,7 @@ describe('ol.format.XSD', function() {
|
||||
|
||||
describe('readDateTime', function() {
|
||||
it('can handle non-Zulu time zones', function() {
|
||||
var node = document.createElement('time');
|
||||
const node = document.createElement('time');
|
||||
node.textContent = '2016-07-12T15:00:00+03:00';
|
||||
expect(new Date(XSD.readDateTime(node) * 1000).toISOString()).to.eql('2016-07-12T12:00:00.000Z');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user