itowns 2.36.1 → 2.36.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,7 +18,6 @@
18
18
  * }).then(function _(res) {
19
19
  * res.csv = Papa.parse(res.csv.trim()).data;
20
20
  * return CSVnVRTParser.parse(res, { out: {
21
- * buildExtent: true,
22
21
  * crs: 'EPSG:4326'
23
22
  * }
24
23
  * });
@@ -6,7 +6,7 @@
6
6
  "transparent": true,
7
7
  "source": {
8
8
  "crs": "EPSG:3857",
9
- "url": "https://wxs.ign.fr/3ht7xcw6f7nciopo16etuqp2/geoportail/wmts",
9
+ "url": "https://wxs.ign.fr/administratif/geoportail/wmts",
10
10
  "format": "image/png",
11
11
  "name": "LIMITES_ADMINISTRATIVES_EXPRESS.LATEST",
12
12
  "style": "normal",
@@ -5,7 +5,7 @@
5
5
  "opacity": 1,
6
6
  "transparent": true,
7
7
  "source": {
8
- "url": "https://wxs.ign.fr/3ht7xcw6f7nciopo16etuqp2/geoportail/wmts",
8
+ "url": "https://wxs.ign.fr/parcellaire/geoportail/wmts",
9
9
  "crs": "EPSG:3857",
10
10
  "networkOptions": {
11
11
  "crossOrigin": "omit"
@@ -4,7 +4,7 @@
4
4
  "transparent": true,
5
5
  "source": {
6
6
  "crs": "EPSG:3857",
7
- "url": "http://wxs.ign.fr/va5orxd0pgzvq3jxutqfuy0b/geoportail/wmts",
7
+ "url": "http://wxs.ign.fr/cartes/geoportail/wmts",
8
8
  "networkOptions": {
9
9
  "crossOrigin": "anonymous"
10
10
  },
@@ -8,7 +8,7 @@
8
8
  }
9
9
  },
10
10
  "source": {
11
- "url": "https://wxs.ign.fr/3ht7xcw6f7nciopo16etuqp2/geoportail/wmts",
11
+ "url": "https://wxs.ign.fr/altimetrie/geoportail/wmts",
12
12
  "crs": "EPSG:4326",
13
13
  "format": "image/x-bil;bits=32",
14
14
  "attribution" : {
@@ -8,7 +8,7 @@
8
8
  }
9
9
  },
10
10
  "source": {
11
- "url": "https://wxs.ign.fr/3ht7xcw6f7nciopo16etuqp2/geoportail/wmts",
11
+ "url": "https://wxs.ign.fr/altimetrie/geoportail/wmts",
12
12
  "crs": "EPSG:4326",
13
13
  "format": "image/x-bil;bits=32",
14
14
  "attribution" : {
@@ -11,7 +11,7 @@
11
11
  "source": {
12
12
  "format": "image/x-bil;bits=32",
13
13
  "crs": "EPSG:4326",
14
- "url": "https://wxs.ign.fr/3ht7xcw6f7nciopo16etuqp2/geoportail/wmts",
14
+ "url": "https://wxs.ign.fr/altimetrie/geoportail/wmts",
15
15
  "name": "ELEVATION.ELEVATIONGRIDCOVERAGE.SRTM3",
16
16
  "tileMatrixSet": "WGS84G",
17
17
  "tileMatrixSetLimits": {
@@ -124,8 +124,6 @@
124
124
  // create new featureCollection
125
125
  const collection = new itowns.FeatureCollection({
126
126
  crs: view.tileLayer.extent.crs,
127
- buildExtent: true,
128
- structure: '2d',
129
127
  });
130
128
 
131
129
  // create new feature
@@ -50,7 +50,6 @@
50
50
  }).then(function _(res) {
51
51
  res.csv = Papa.parse(res.csv.trim()).data;
52
52
  return CSVnVRTParser.parse(res, { out: {
53
- buildExtent: true,
54
53
  crs: view.tileLayer.extent.crs,
55
54
  }});
56
55
  }).then(function _(features) {
@@ -109,9 +109,6 @@
109
109
  // Here, we pass a FeatureBuildingOptions (http://www.itowns-project.org/itowns/docs/#api/Base/FeatureBuildingOptions)
110
110
  out: {
111
111
  crs: view.tileLayer.extent.crs,
112
- buildExtent: true,
113
- mergeFeatures: true,
114
- structure: '2d',
115
112
  },
116
113
  });
117
114
  }).then(function _(features) {
@@ -50,7 +50,6 @@
50
50
  return itowns.ShapefileParser.parse(res, {
51
51
  out: {
52
52
  crs: view.tileLayer.extent.crs,
53
- buildExtent: true,
54
53
  }
55
54
  });
56
55
  }).then(function _(features) {
@@ -81,17 +81,18 @@ exports.FEATURE_TYPES = FEATURE_TYPES;
81
81
  var typeToStyleProperty = ['point', 'stroke', 'fill'];
82
82
  /**
83
83
  * @property {string} crs - The CRS to convert the input coordinates to.
84
+ * @property {string} [structure='2d'] - data structure type : 2d or 3d.
85
+ * If the structure is 3d, the feature have 3 dimensions by vertices positions and
86
+ * a normal for each vertices.
84
87
  * @property {Extent|boolean} [filteringExtent=undefined] - Optional filter to reject
85
- * features outside of extent. Extent filetring is file extent if filteringExtent is true.
86
- * @property {boolean} [buildExtent=false] - If true the geometry will
88
+ * features outside of extent. Extent filtering is file extent if filteringExtent is true.
89
+ * @property {boolean} [buildExtent] - If true the geometry will
87
90
  * have an extent property containing the area covered by the geometry.
91
+ * Default value is false if `structure` parameter is set to '3d', and true otherwise.
88
92
  * True if the layer does not inherit from {@link GeometryLayer}.
89
93
  * @property {string} forcedExtentCrs - force feature extent crs if buildExtent is true.
90
94
  * @property {function} [filter] - Filter function to remove features
91
- * @property {boolean} [mergeFeatures=true] - If true all geometries are merged by type and multi-type
92
- * @property {string} [structure='2d'] - data structure type : 2d or 3d.
93
- * If the structure is 3d, the feature have 3 dimensions by vertices positions and
94
- * a normal for each vertices.
95
+ * @property {boolean} [mergeFeatures=true] - If true all geometries are merged by type and multi-type.
95
96
  * @property {Style} style - The style to inherit when creating
96
97
  * style for all new features.
97
98
  *
@@ -464,7 +465,6 @@ var FeatureCollection = /*#__PURE__*/function (_THREE$Object3D) {
464
465
  _this.crs = _Crs["default"].formatToEPSG(options.crs);
465
466
  _this.features = [];
466
467
  _this.mergeFeatures = options.mergeFeatures === undefined ? true : options.mergeFeatures;
467
- _this.extent = options.buildExtent ? defaultExtent(options.forcedExtentCrs || _this.crs) : undefined;
468
468
  _this.size = options.structure == '3d' ? 3 : 2;
469
469
  _this.filterExtent = options.filterExtent;
470
470
  _this.style = options.style;
@@ -473,6 +473,8 @@ var FeatureCollection = /*#__PURE__*/function (_THREE$Object3D) {
473
473
  _this.center = new _Coordinates["default"]('EPSG:4326', 0, 0);
474
474
 
475
475
  if (_this.size == 2) {
476
+ _this.extent = options.buildExtent === false ? undefined : defaultExtent(options.forcedExtentCrs || _this.crs);
477
+
476
478
  _this._setLocalSystem = function (center) {
477
479
  // set local system center
478
480
  center.as('EPSG:4326', _this.center); // set position to local system center
@@ -486,6 +488,8 @@ var FeatureCollection = /*#__PURE__*/function (_THREE$Object3D) {
486
488
 
487
489
  _this._transformToLocalSystem = transformToLocalSystem2D;
488
490
  } else {
491
+ _this.extent = options.buildExtent ? defaultExtent(options.forcedExtentCrs || _this.crs) : undefined;
492
+
489
493
  _this._setLocalSystem = function (center) {
490
494
  // set local system center
491
495
  center.as('EPSG:4326', _this.center);
@@ -263,20 +263,20 @@ var Coordinates = /*#__PURE__*/function () {
263
263
  return v0.distanceTo(v1);
264
264
  }
265
265
  /**
266
- * Calculate geodesic distance between this coordinates and `coord`.
267
- * **Geodesic distance** is calculated in an ellispoid space as the distance
266
+ * Calculate geodetic distance between this coordinates and `coord`.
267
+ * **Geodetic distance** is calculated in an ellispoid space as the shortest distance
268
268
  * across the curved surface of the world.
269
269
  *
270
270
  * => As the crow flies/ Orthodromy
271
271
  *
272
272
  * @param {Coordinates} coord The coordinate
273
- * @return {number} geodesic distance
273
+ * @return {number} geodetic distance
274
274
  *
275
275
  */
276
276
 
277
277
  }, {
278
- key: "geodesicDistanceTo",
279
- value: function geodesicDistanceTo(coord) {
278
+ key: "geodeticDistanceTo",
279
+ value: function geodeticDistanceTo(coord) {
280
280
  this.as('EPSG:4326', coord0);
281
281
  coord.as('EPSG:4326', coord1);
282
282
  return ellipsoid.geodesicDistance(coord0, coord1);
@@ -290,8 +290,8 @@ var Coordinates = /*#__PURE__*/function () {
290
290
  */
291
291
 
292
292
  }, {
293
- key: "earthEuclideanDistanceTo",
294
- value: function earthEuclideanDistanceTo(coord) {
293
+ key: "spatialEuclideanDistanceTo",
294
+ value: function spatialEuclideanDistanceTo(coord) {
295
295
  this.as('EPSG:4978', coord0).toVector3(v0);
296
296
  coord.as('EPSG:4978', coord1).toVector3(v1);
297
297
  return v0.distanceTo(v1);
@@ -326,7 +326,7 @@ var Extent = /*#__PURE__*/function () {
326
326
  key: "dimensions",
327
327
  value: function dimensions() {
328
328
  var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new THREE.Vector2();
329
- console.warn('Extent.dimensions is deprecated, use planarDimensions, geodesicDimensions or geodesicChordDimensions');
329
+ console.warn('Extent.dimensions is deprecated, use planarDimensions, geodeticDimensions or spatialEuclideanDimensions');
330
330
  target.x = Math.abs(this.east - this.west);
331
331
  target.y = Math.abs(this.north - this.south);
332
332
  return target;
@@ -347,17 +347,17 @@ var Extent = /*#__PURE__*/function () {
347
347
  return target.set(Math.abs(this.east - this.west), Math.abs(this.north - this.south));
348
348
  }
349
349
  /**
350
- * Geodesic dimensions are two planar distances west/east and south/north.
351
- * Geodesic distance is calculated in an ellispoid space as the distance
350
+ * Geodetic dimensions are two planar distances west/east and south/north.
351
+ * Geodetic distance is calculated in an ellispoid space as the distance
352
352
  * across the curved surface of the world.
353
353
  *
354
354
  * @param {THREE.Vector2} [target=new THREE.Vector2()] The target
355
- * @return {THREE.Vector2} Planar dimensions
355
+ * @return {THREE.Vector2} geodetic dimensions
356
356
  */
357
357
 
358
358
  }, {
359
- key: "geodesicDimensions",
360
- value: function geodesicDimensions() {
359
+ key: "geodeticDimensions",
360
+ value: function geodeticDimensions() {
361
361
  var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new THREE.Vector2();
362
362
  // set 3 corners extent
363
363
  cNorthWest.crs = this.crs;
@@ -365,21 +365,21 @@ var Extent = /*#__PURE__*/function () {
365
365
  cNorthEast.crs = this.crs;
366
366
  cNorthWest.setFromValues(this.west, this.north, 0);
367
367
  cSouthWest.setFromValues(this.west, this.south, 0);
368
- cNorthEast.setFromValues(this.east, this.north, 0); // calcul geodesic distance northWest/northEast and northWest/southWest
368
+ cNorthEast.setFromValues(this.east, this.north, 0); // calcul geodetic distance northWest/northEast and northWest/southWest
369
369
 
370
- return target.set(cNorthWest.geodesicDistanceTo(cNorthEast), cNorthWest.geodesicDistanceTo(cSouthWest));
370
+ return target.set(cNorthWest.geodeticDistanceTo(cNorthEast), cNorthWest.geodeticDistanceTo(cSouthWest));
371
371
  }
372
372
  /**
373
- * Earth euclidean dimensions are two earth euclidean distances between west/east and south/north.
374
- * Earth euclidean distance chord is calculated in a ellispoid space.
373
+ * Spatial euclidean dimensions are two spatial euclidean distances between west/east corner and south/north corner.
374
+ * Spatial euclidean distance chord is calculated in a ellispoid space.
375
375
  *
376
376
  * @param {THREE.Vector2} [target=new THREE.Vector2()] The target
377
- * @return {THREE.Vector2} Earth euclidean dimensions
377
+ * @return {THREE.Vector2} spatial euclidean dimensions
378
378
  */
379
379
 
380
380
  }, {
381
- key: "earthEuclideanDimensions",
382
- value: function earthEuclideanDimensions() {
381
+ key: "spatialEuclideanDimensions",
382
+ value: function spatialEuclideanDimensions() {
383
383
  var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new THREE.Vector2();
384
384
  // set 3 corners extent
385
385
  cNorthWest.crs = this.crs;
@@ -389,7 +389,7 @@ var Extent = /*#__PURE__*/function () {
389
389
  cSouthWest.setFromValues(this.west, this.south, 0);
390
390
  cNorthEast.setFromValues(this.east, this.north, 0); // calcul chord distance northWest/northEast and northWest/southWest
391
391
 
392
- return target.set(cNorthWest.earthEuclideanDistanceTo(cNorthEast), cNorthWest.earthEuclideanDistanceTo(cSouthWest));
392
+ return target.set(cNorthWest.spatialEuclideanDistanceTo(cNorthEast), cNorthWest.spatialEuclideanDistanceTo(cSouthWest));
393
393
  }
394
394
  /**
395
395
  * Return true if `coord` is inside the bounding box.
package/lib/Main.js CHANGED
@@ -690,7 +690,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
690
690
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
691
691
 
692
692
  var conf = {
693
- version: '2.36.1'
693
+ version: '2.36.2'
694
694
  };
695
695
  var REVISION = conf.version; // Geographic tools
696
696
 
@@ -44,7 +44,6 @@ var _Undeprecator = require("../Core/Deprecated/Undeprecator");
44
44
  * },
45
45
  * out: {
46
46
  * crs: view.tileLayer.extent.crs,
47
- * buildExtent: true,
48
47
  * }
49
48
  * });
50
49
  * }).then(function _(geojson) {
@@ -106,13 +106,8 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
106
106
  * itowns.Fetcher.json('https://raw.githubusercontent.com/gregoiredavid/france-geojson/master/departements/09-ariege/departement-09-ariege.geojson')
107
107
  * .then(function _(geojson) {
108
108
  * return itowns.GeoJsonParser.parse(geojson, {
109
- * in: { in: 'EPSG:4326' },
110
- * out: {
111
- * crs: view.tileLayer.extent.crs,
112
- * buildExtent: true,
113
- * mergeFeatures: true,
114
- * structure: '2d',
115
- * },
109
+ * in: { crs: 'EPSG:4326' },
110
+ * out: { crs: view.tileLayer.extent.crs },
116
111
  * });
117
112
  * }).then(function _(features) {
118
113
  * ariege.source = new itowns.FileSource({
@@ -182,10 +182,13 @@ var VectorTilesSource = /*#__PURE__*/function (_TMSSource) {
182
182
  var _this2 = this;
183
183
 
184
184
  (0, _get2["default"])((0, _getPrototypeOf2["default"])(VectorTilesSource.prototype), "onLayerAdded", this).call(this, options);
185
- var keys = Object.keys(this.styles);
186
- keys.forEach(function (k) {
187
- _this2.styles[k].parent = options.out.style;
188
- });
185
+
186
+ if (options.out.style) {
187
+ var keys = Object.keys(this.styles);
188
+ keys.forEach(function (k) {
189
+ _this2.styles[k].parent = options.out.style;
190
+ });
191
+ }
189
192
  }
190
193
  }]);
191
194
  return VectorTilesSource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itowns",
3
- "version": "2.36.1",
3
+ "version": "2.36.2",
4
4
  "description": "A JS/WebGL framework for 3D geospatial data visualization",
5
5
  "main": "lib/Main.js",
6
6
  "scripts": {