diff --git a/src/Converter/Feature2Mesh.js b/src/Converter/Feature2Mesh.js index d3d4905ec9..85dca95ac1 100644 --- a/src/Converter/Feature2Mesh.js +++ b/src/Converter/Feature2Mesh.js @@ -1,5 +1,4 @@ import * as THREE from 'three'; -import * as Crs from 'Core/Geographic/Crs'; import Earcut from 'earcut'; import { FEATURE_TYPES } from 'Core/Feature'; import ReferLayerProperties from 'Layer/ReferencingLayerProperties'; @@ -64,7 +63,7 @@ class FeatureMesh extends THREE.Group { } else { // calculate the scale transformation to transform the feature.extent // to feature.extent.as(crs) - coord.crs = Crs.formatToEPSG(this.#originalCrs); + coord.crs = this.#originalCrs; // TODO: An extent here could be either a geographic extent (for // features from WFS) or a tiled extent (for features from MVT). // Unify both behavior. diff --git a/src/Converter/textureConverter.js b/src/Converter/textureConverter.js index 9db079146e..5455e9d96f 100644 --- a/src/Converter/textureConverter.js +++ b/src/Converter/textureConverter.js @@ -1,5 +1,4 @@ import * as THREE from 'three'; -import * as CRS from 'Core/Geographic/Crs'; import Feature2Texture from 'Converter/Feature2Texture'; import Extent from 'Core/Geographic/Extent'; @@ -27,7 +26,7 @@ export default { new THREE.Color(backgroundLayer.paint['background-color']) : undefined; - destinationTile.toExtent(CRS.formatToEPSG(layer.crs), extentTexture); + destinationTile.toExtent(layer.crs, extentTexture); texture = Feature2Texture.createTextureFromFeature(data, extentTexture, layer.subdivisionThreshold, layer.style, backgroundColor); texture.features = data; texture.extent = destinationTile; diff --git a/src/Core/Feature.js b/src/Core/Feature.js index 0e250a533b..018bb45c95 100644 --- a/src/Core/Feature.js +++ b/src/Core/Feature.js @@ -1,5 +1,4 @@ import * as THREE from 'three'; -import * as CRS from 'Core/Geographic/Crs'; import Extent from 'Core/Geographic/Extent'; import Coordinates from 'Core/Geographic/Coordinates'; import Style from 'Core/Style'; @@ -347,7 +346,7 @@ export class FeatureCollection extends THREE.Object3D { constructor(options) { super(); this.isFeatureCollection = true; - this.crs = CRS.formatToEPSG(options.accurate || !options.source?.crs ? options.crs : options.source.crs); + this.crs = options.accurate || !options.source?.crs ? options.crs : options.source.crs; this.features = []; this.mergeFeatures = options.mergeFeatures === undefined ? true : options.mergeFeatures; this.size = options.structure == '3d' ? 3 : 2; diff --git a/src/Core/Geographic/Crs.ts b/src/Core/Geographic/Crs.ts index 73bbcbddc7..9580dcfb77 100644 --- a/src/Core/Geographic/Crs.ts +++ b/src/Core/Geographic/Crs.ts @@ -21,48 +21,6 @@ function mustBeString(crs: string) { } } -/** - * Checks that a given CRS identifier follows the TMS:XXXX format. - * @internal - * - * @param crs - The CRS identifier string. - */ -export function isTms(crs: string) { - return isString(crs) && crs.startsWith('TMS'); -} - -/** - * Checks that a given CRS identifier follows the EPSG:XXXX format. - * @internal - * - * @param crs - The CRS identifier string. - */ -export function isEpsg(crs: string) { - return isString(crs) && crs.startsWith('EPSG'); -} - -/** - * Converts the input to the tile matrix set notation: TMS:XXXX. - * @internal - * - * @param crs - The input to format. - */ -export function formatToTms(crs: string) { - mustBeString(crs); - return isTms(crs) ? crs : `TMS:${crs.match(/\d+/)?.[0]}`; -} - -/** - * Converts the input to European Petroleum Survey Group notation: EPSG:XXXX. - * @internal - * - * @param crs - The input to format. - */ -export function formatToEPSG(crs: string) { - mustBeString(crs); - return isEpsg(crs) ? crs : `EPSG:${crs.match(/\d+/)?.[0]}`; -} - /** * System units supported for a coordinate system. See * [proj](https://proj4.org/en/9.5/operations/conversions/unitconvert.html#angular-units). @@ -79,15 +37,6 @@ export const UNIT = { METER: 2, } as const; -/** - * @internal - */ -export const tms_3857 = 'TMS:3857'; -/** - * @internal - */ -export const tms_4326 = 'TMS:4326'; - /** * Checks that the CRS is EPSG:4326. * @internal @@ -120,7 +69,7 @@ function unitFromProj4Unit(proj: ProjectionDefinition) { */ export function getUnit(crs: ProjectionLike) { mustBeString(crs); - const p = proj4.defs(formatToEPSG(crs)); + const p = proj4.defs(crs); if (!p) { return undefined; } diff --git a/src/Core/Geographic/Extent.js b/src/Core/Geographic/Extent.js index 10482b7fa9..39c9ddf1ab 100644 --- a/src/Core/Geographic/Extent.js +++ b/src/Core/Geographic/Extent.js @@ -49,10 +49,6 @@ class Extent { throw new Error(`${crs} is a geocentric projection, it doesn't make sense with a geographical extent`); } - if (CRS.isTms(crs)) { - throw new Error(`${crs} is a tiled projection, use Tile instead`); - } - this.isExtent = true; this.crs = crs; diff --git a/src/Core/Prefab/Globe/GlobeLayer.js b/src/Core/Prefab/Globe/GlobeLayer.js index 629b085e59..1fed4cd883 100644 --- a/src/Core/Prefab/Globe/GlobeLayer.js +++ b/src/Core/Prefab/Globe/GlobeLayer.js @@ -1,5 +1,4 @@ import * as THREE from 'three'; -import * as CRS from 'Core/Geographic/Crs'; import TiledGeometryLayer from 'Layer/TiledGeometryLayer'; import { ellipsoidSizes } from 'Core/Math/Ellipsoid'; import { globalExtentTMS, schemeTiles } from 'Core/Tile/TileGrid'; @@ -48,13 +47,13 @@ class GlobeLayer extends TiledGeometryLayer { */ constructor(id, object3d, config = {}) { // Configure tiles - const scheme = schemeTiles.get(CRS.tms_4326); + const scheme = schemeTiles.get('EPSG:4326'); const schemeTile = globalExtentTMS.get('EPSG:4326').subdivisionByScheme(scheme); // Supported tile matrix set for color/elevation layer config.tileMatrixSets = [ - CRS.tms_4326, - CRS.tms_3857, + 'EPSG:4326', + 'EPSG:3857', ]; const uvCount = config.tileMatrixSets.length; const builder = new BuilderEllipsoidTile({ crs: 'EPSG:4978', uvCount }); @@ -104,7 +103,7 @@ class GlobeLayer extends TiledGeometryLayer { subdivision(context, layer, node) { if (node.level == 5) { - const row = node.getExtentsByProjection(CRS.tms_4326)[0].row; + const row = node.getExtentsByProjection('EPSG:4326')[0].row; if (row == 31 || row == 0) { // doesn't subdivise the pole return false; diff --git a/src/Core/Prefab/GlobeView.js b/src/Core/Prefab/GlobeView.js index ce70a36ebb..ce90a53661 100644 --- a/src/Core/Prefab/GlobeView.js +++ b/src/Core/Prefab/GlobeView.js @@ -1,7 +1,5 @@ import * as THREE from 'three'; -import * as CRS from 'Core/Geographic/Crs'; - import View, { VIEW_EVENTS } from 'Core/View'; import GlobeControls from 'Controls/GlobeControls'; import Coordinates from 'Core/Geographic/Coordinates'; @@ -139,11 +137,11 @@ class GlobeView extends View { return Promise.reject(new Error('Add Layer type object')); } if (layer.isColorLayer) { - if (!this.tileLayer.tileMatrixSets.includes(CRS.formatToTms(layer.source.crs))) { + if (!this.tileLayer.tileMatrixSets.includes(layer.source.crs)) { return layer._reject(`Only ${this.tileLayer.tileMatrixSets} tileMatrixSet are currently supported for color layers`); } } else if (layer.isElevationLayer) { - if (CRS.formatToTms(layer.source.crs) !== this.tileLayer.tileMatrixSets[0]) { + if (layer.source.crs !== this.tileLayer.tileMatrixSets[0]) { return layer._reject(`Only ${this.tileLayer.tileMatrixSets[0]} tileMatrixSet is currently supported for elevation layers`); } } diff --git a/src/Core/Prefab/Planar/PlanarLayer.js b/src/Core/Prefab/Planar/PlanarLayer.js index d1fbb9f7d6..0a3bad7079 100644 --- a/src/Core/Prefab/Planar/PlanarLayer.js +++ b/src/Core/Prefab/Planar/PlanarLayer.js @@ -1,6 +1,5 @@ import * as THREE from 'three'; -import * as CRS from 'Core/Geographic/Crs'; import TiledGeometryLayer from 'Layer/TiledGeometryLayer'; import { globalExtentTMS } from 'Core/Tile/TileGrid'; import PlanarTileBuilder from './PlanarTileBuilder'; @@ -35,8 +34,7 @@ class PlanarLayer extends TiledGeometryLayer { * @throws {Error} `object3d` must be a valid `THREE.Object3d`. */ constructor(id, extent, object3d, config = {}) { - const tms = CRS.formatToTms(extent.crs); - const tileMatrixSets = [tms]; + const tileMatrixSets = [extent.crs]; if (!globalExtentTMS.get(extent.crs)) { // Add new global extent for this new crs projection. globalExtentTMS.set(extent.crs, extent); diff --git a/src/Core/Tile/Tile.js b/src/Core/Tile/Tile.js index bda353c21f..d0912b7c90 100644 --- a/src/Core/Tile/Tile.js +++ b/src/Core/Tile/Tile.js @@ -169,10 +169,10 @@ class Tile { * @returns {Tile[]} */ export function tiledCovering(e, tms) { - if (e.crs == 'EPSG:4326' && tms == CRS.tms_3857) { + if (e.crs == 'EPSG:4326' && tms == 'EPSG:3857') { const WMTS_PM = []; - const extent = _extent.copy(e).as(CRS.formatToEPSG(tms), _extent2); - const { globalExtent, globalDimension, sTs } = getInfoTms(CRS.formatToEPSG(tms)); + const extent = _extent.copy(e).as(tms, _extent2); + const { globalExtent, globalDimension, sTs } = getInfoTms(tms); extent.clampByExtent(globalExtent); extent.planarDimensions(_dimensionTile); diff --git a/src/Core/Tile/TileGrid.js b/src/Core/Tile/TileGrid.js index 0a60f8d586..a6eb619b35 100644 --- a/src/Core/Tile/TileGrid.js +++ b/src/Core/Tile/TileGrid.js @@ -1,5 +1,4 @@ import * as THREE from 'three'; -import * as CRS from '../Geographic/Crs'; import Extent from '../Geographic/Extent'; const _countTiles = new THREE.Vector2(); @@ -19,27 +18,25 @@ extent3857.clampSouthNorth(extent3857.west, extent3857.east); globalExtentTMS.set('EPSG:3857', extent3857); schemeTiles.set('default', new THREE.Vector2(1, 1)); -schemeTiles.set(CRS.tms_3857, schemeTiles.get('default')); -schemeTiles.set(CRS.tms_4326, new THREE.Vector2(2, 1)); +schemeTiles.set('EPSG:3857', schemeTiles.get('default')); +schemeTiles.set('EPSG:4326', new THREE.Vector2(2, 1)); export function getInfoTms(/** @type {string} */ crs) { - const epsg = CRS.formatToEPSG(crs); - const globalExtent = globalExtentTMS.get(epsg); + const globalExtent = globalExtentTMS.get(crs); const globalDimension = globalExtent.planarDimensions(_dim); - const tms = CRS.formatToTms(crs); - const sTs = schemeTiles.get(tms) || schemeTiles.get('default'); + const sTs = schemeTiles.get(crs) || schemeTiles.get('default'); // The isInverted parameter is to be set to the correct value, true or false // (default being false) if the computation of the coordinates needs to be // inverted to match the same scheme as OSM, Google Maps or other system. // See link below for more information // https://alastaira.wordpress.com/2011/07/06/converting-tms-tile-coordinates-to-googlebingosm-tile-coordinates/ // in crs includes ':NI' => tms isn't inverted (NOT INVERTED) - const isInverted = !tms.includes(':NI'); - return { epsg, globalExtent, globalDimension, sTs, isInverted }; + const isInverted = !crs.includes(':NI'); + return { epsg: crs, globalExtent, globalDimension, sTs, isInverted }; } export function getCountTiles(/** @type {string} */ crs, /** @type {number} */ zoom) { - const sTs = schemeTiles.get(CRS.formatToTms(crs)) || schemeTiles.get('default'); + const sTs = schemeTiles.get(crs) || schemeTiles.get('default'); const count = 2 ** zoom; _countTiles.set(count, count).multiply(sTs); return _countTiles; diff --git a/src/Core/TileMesh.js b/src/Core/TileMesh.js index a647ee6f97..a12b4f967a 100644 --- a/src/Core/TileMesh.js +++ b/src/Core/TileMesh.js @@ -1,5 +1,4 @@ import * as THREE from 'three'; -import * as CRS from 'Core/Geographic/Crs'; import { geoidLayerIsVisible } from 'Layer/GeoidLayer'; import { tiledCovering } from 'Core/Tile/Tile'; @@ -77,7 +76,7 @@ class TileMesh extends THREE.Mesh { } getExtentsByProjection(crs) { - return this.#_tms.get(CRS.formatToTms(crs)); + return this.#_tms.get(crs); } /** diff --git a/src/Core/View.js b/src/Core/View.js index 71a00bdd45..72dff1f4ea 100644 --- a/src/Core/View.js +++ b/src/Core/View.js @@ -55,7 +55,7 @@ function _preprocessLayer(view, layer, parentLayer) { // Find crs projection layer, this is projection destination layer.crs = view.referenceCrs; } else if (!layer.crs) { - if (parentLayer && parentLayer.tileMatrixSets && parentLayer.tileMatrixSets.includes(CRS.formatToTms(source.crs))) { + if (parentLayer && parentLayer.tileMatrixSets && parentLayer.tileMatrixSets.includes(source.crs)) { layer.crs = source.crs; } else { layer.crs = parentLayer && parentLayer.extent.crs; diff --git a/src/Renderer/OBB.js b/src/Renderer/OBB.js index 6b00000986..567cce69f6 100644 --- a/src/Renderer/OBB.js +++ b/src/Renderer/OBB.js @@ -126,7 +126,7 @@ class OBB extends THREE.Object3D { this.position.copy(position); this.quaternion.copy(quaternion); this.updateMatrixWorld(true); - } else if (!CRS.isTms(extent.crs) && CRS.isMetricUnit(extent.crs)) { + } else if (CRS.isMetricUnit(extent.crs)) { extent.center(coord).toVector3(this.position); extent.planarDimensions(dimension); size.set(dimension.x, dimension.y, Math.abs(maxHeight - minHeight)); diff --git a/src/Renderer/RasterTile.js b/src/Renderer/RasterTile.js index a218be7b8b..af87699426 100644 --- a/src/Renderer/RasterTile.js +++ b/src/Renderer/RasterTile.js @@ -1,5 +1,4 @@ import * as THREE from 'three'; -import * as CRS from 'Core/Geographic/Crs'; import { ELEVATION_MODES } from 'Renderer/LayeredMaterial'; import { checkNodeElevationTextureValidity, insertSignificantValuesFromParent, computeMinMaxElevation } from 'Parser/XbilParser'; @@ -32,7 +31,7 @@ class RasterTile extends THREE.EventDispatcher { constructor(material, layer) { super(); this.layer = layer; - this.crs = layer.parent.tileMatrixSets.indexOf(CRS.formatToTms(layer.crs)); + this.crs = layer.parent.tileMatrixSets.indexOf(layer.crs); if (this.crs == -1) { console.error('Unknown crs:', layer.crs); } diff --git a/src/Source/FileSource.js b/src/Source/FileSource.js index d5d7eda6bf..a65ce63271 100644 --- a/src/Source/FileSource.js +++ b/src/Source/FileSource.js @@ -1,4 +1,3 @@ -import * as CRS from 'Core/Geographic/Crs'; import Source from 'Source/Source'; import Cache from 'Core/Scheduler/Cache'; @@ -159,7 +158,7 @@ class FileSource extends Source { if (!features) { options.out.buildExtent = this.crs != 'EPSG:4978'; if (options.out.buildExtent) { - options.out.forcedExtentCrs = options.out.crs != 'EPSG:4978' ? options.out.crs : CRS.formatToEPSG(this.crs); + options.out.forcedExtentCrs = options.out.crs != 'EPSG:4978' ? options.out.crs : this.crs; } features = this.parser(this.fetchedData, options); this._featuresCaches[options.out.crs].setByArray(features, [0]); diff --git a/src/Source/TMSSource.js b/src/Source/TMSSource.js index 2359b98363..6d669ceec3 100644 --- a/src/Source/TMSSource.js +++ b/src/Source/TMSSource.js @@ -1,11 +1,10 @@ -import * as CRS from 'Core/Geographic/Crs'; import Source from 'Source/Source'; import URLBuilder from 'Provider/URLBuilder'; import Extent from 'Core/Geographic/Extent'; import Tile from 'Core/Tile/Tile'; import { globalExtentTMS } from 'Core/Tile/TileGrid'; -const _tile = new Tile(CRS.tms_4326, 0, 0, 0); +const _tile = new Tile('EPSG:4326', 0, 0, 0); /** * An object defining the source of resources to get from a @@ -95,7 +94,7 @@ class TMSSource extends Source { this.zoom = source.zoom; this.isInverted = source.isInverted || false; - this.crs = CRS.formatToTms(source.crs); + this.crs = source.crs; this.tileMatrixSetLimits = source.tileMatrixSetLimits; this.extentSetlimits = {}; this.tileMatrixCallback = source.tileMatrixCallback || (zoomLevel => zoomLevel); diff --git a/src/Source/WFSSource.js b/src/Source/WFSSource.js index 4f68286453..5d2c771fa6 100644 --- a/src/Source/WFSSource.js +++ b/src/Source/WFSSource.js @@ -1,4 +1,3 @@ -import * as CRS from 'Core/Geographic/Crs'; import Source from 'Source/Source'; import URLBuilder from 'Provider/URLBuilder'; import Extent from 'Core/Geographic/Extent'; @@ -161,7 +160,7 @@ class WFSSource extends Source { } requestToKey(extent) { - if (CRS.isTms(extent.crs)) { + if (extent.isTile) { return super.requestToKey(extent); } else { return [extent.zoom, extent.south, extent.west]; diff --git a/test/functional/vector_tile_3d_mesh_mapbox.js b/test/functional/vector_tile_3d_mesh_mapbox.js index 98093a678b..b307e8e0cc 100644 --- a/test/functional/vector_tile_3d_mesh_mapbox.js +++ b/test/functional/vector_tile_3d_mesh_mapbox.js @@ -13,7 +13,7 @@ describe('vector_tile_3d_mesh_mapbox', function _describe() { it('should correctly load building features on a given TMS tile', async function _it() { const featuresCollection = await page.evaluate(async function _() { const layers = view.getLayers(l => l.source && l.source.isVectorSource); - const res = await layers[0].source.loadData({ zoom: 15, row: 11634, col: 16859 }, { crs: 'EPSG:4978', source: { crs: 'TMS:3857' } }); + const res = await layers[0].source.loadData({ zoom: 15, row: 11634, col: 16859 }, { crs: 'EPSG:4978', source: { crs: 'EPSG:3857' } }); return res; }); assert.ok(featuresCollection.isFeatureCollection); diff --git a/test/unit/layeredmaterial.js b/test/unit/layeredmaterial.js index 6a4fe7a85e..89f171abf0 100644 --- a/test/unit/layeredmaterial.js +++ b/test/unit/layeredmaterial.js @@ -35,7 +35,7 @@ describe('material state vs layer state', function () { view.tileLayer.colorLayersOrder = [layer.id]; view.addLayer(layer); - const extent = new Tile('TMS:4326', 3, 0, 0).toExtent('EPSG:4326'); + const extent = new Tile('EPSG:4326', 3, 0, 0).toExtent('EPSG:4326'); material = new LayeredMaterial(); const geom = new THREE.BufferGeometry(); geom.OBB = new OBB(new THREE.Vector3(), new THREE.Vector3(1, 1, 1)); diff --git a/test/unit/layeredmaterialnodeprocessing.js b/test/unit/layeredmaterialnodeprocessing.js index 9aae1ea00c..0f7e92af02 100644 --- a/test/unit/layeredmaterialnodeprocessing.js +++ b/test/unit/layeredmaterialnodeprocessing.js @@ -41,12 +41,12 @@ describe('updateLayeredMaterialNodeImagery', function () { crs: 'EPSG:4326', info: { update: () => {} }, tileMatrixSets: [ - 'TMS:4326', - 'TMS:3857', + 'EPSG:4326', + 'EPSG:3857', ], parent: { tileMatrixSets: [ - 'TMS:4326', - 'TMS:3857', + 'EPSG:4326', + 'EPSG:3857', ], }, }); diff --git a/test/unit/layerupdatestrategy.js b/test/unit/layerupdatestrategy.js index 2e4ebe488a..89b7abceda 100644 --- a/test/unit/layerupdatestrategy.js +++ b/test/unit/layerupdatestrategy.js @@ -44,12 +44,12 @@ describe('Handling no data source error', function () { crs: 'EPSG:4326', info: { update: () => {} }, tileMatrixSets: [ - 'TMS:4326', - 'TMS:3857', + 'EPSG:4326', + 'EPSG:3857', ], parent: { tileMatrixSets: [ - 'TMS:4326', - 'TMS:3857', + 'EPSG:4326', + 'EPSG:3857', ], }, }); diff --git a/test/unit/provider_url.js b/test/unit/provider_url.js index 599dc94249..28a714e95f 100644 --- a/test/unit/provider_url.js +++ b/test/unit/provider_url.js @@ -8,14 +8,14 @@ describe('URL creations', function () { const layer = { tileMatrixCallback: (zoomLevel => zoomLevel) }; it('should correctly replace ${x}, ${y} and ${z} by 359, 512 and 10', function () { - const coords = new Tile('TMS:4857', 10, 512, 359); + const coords = new Tile('EPSG:4857', 10, 512, 359); layer.url = 'http://server.geo/tms/${z}/${y}/${x}.jpg'; const result = URLBuilder.xyz(coords, layer); assert.equal(result, 'http://server.geo/tms/10/512/359.jpg'); }); it('should correctly replace %COL, %ROW, %TILEMATRIX by 2072, 1410 and 12', function () { - const coords = new Tile('TMS:4326', 12, 1410, 2072); + const coords = new Tile('EPSG:4326', 12, 1410, 2072); layer.url = 'http://server.geo/wmts/SERVICE=WMTS&TILEMATRIX=%TILEMATRIX&TILEROW=%ROW&TILECOL=%COL'; const result = URLBuilder.xyz(coords, layer); assert.equal(result, 'http://server.geo/wmts/SERVICE=WMTS&TILEMATRIX=12&TILEROW=1410&TILECOL=2072'); diff --git a/test/unit/source.js b/test/unit/source.js index 2a3a404d06..9e9d5a9b22 100644 --- a/test/unit/source.js +++ b/test/unit/source.js @@ -79,7 +79,7 @@ describe('Sources', function () { it('should return keys from request', function () { const source = new WFSSource(paramsWFS); - const tile = new Tile('TMS:4326', 5, 10, 15); + const tile = new Tile('EPSG:4326', 5, 10, 15); const keys = source.requestToKey(tile); assert.equal(tile.zoom, keys[0]); assert.equal(tile.row, keys[1]); @@ -105,7 +105,7 @@ describe('Sources', function () { it('should instance and use WMTSSource', function () { const source = new WMTSSource(paramsWMTS); - const extent = new Tile('TMS:3857', 5, 0, 0); + const extent = new Tile('EPSG:3857', 5, 0, 0); assert.ok(source.isWMTSSource); assert.ok(source.urlFromExtent(extent)); assert.ok(source.extentInsideLimit(extent, 5)); @@ -122,7 +122,7 @@ describe('Sources', function () { 5: { minTileRow: 0, maxTileRow: 32, minTileCol: 0, maxTileCol: 32 }, }; const source = new WMTSSource(paramsWMTS); - const extent = new Tile('TMS:3857', 5, 0, 0); + const extent = new Tile('EPSG:3857', 5, 0, 0); source.onLayerAdded({ out: { crs: 'EPSG:4326' } }); assert.ok(source.isWMTSSource); assert.ok(source.urlFromExtent(extent)); @@ -132,7 +132,7 @@ describe('Sources', function () { it('should use vendor specific parameters for the creation of the WMTS url', function () { paramsWMTS.vendorSpecific = vendorSpecific; const source = new WMTSSource(paramsWMTS); - const tile = new Tile('TMS:4326', 0, 10, 0); + const tile = new Tile('EPSG:4326', 0, 10, 0); const url = source.urlFromExtent(tile); const end = '&buffer=4096&format_options=dpi:300;quantizer:octree&tiled=true'; assert.ok(url.endsWith(end)); @@ -203,7 +203,7 @@ describe('Sources', function () { it('should instance and use TMSSource', function () { const source = new TMSSource(paramsTMS); source.onLayerAdded({ out: { crs: 'EPSG:4326' } }); - const extent = new Tile('TMS:3857', 5, 0, 0); + const extent = new Tile('EPSG:3857', 5, 0, 0); assert.ok(source.isTMSSource); assert.ok(source.urlFromExtent(extent)); assert.ok(source.extentInsideLimit(extent, extent.zoom)); diff --git a/test/unit/tile.js b/test/unit/tile.js index 3512ef27c5..845c29f5b5 100644 --- a/test/unit/tile.js +++ b/test/unit/tile.js @@ -9,24 +9,24 @@ describe('Tile', function () { const row = 22; const col = 10; - it('should convert tile TMS:4326 like expected', function () { - const withValues = new Tile('TMS:4326', 0, 0, 0).toExtent('EPSG:4326'); + it('should convert tile EPSG:4326 like expected', function () { + const withValues = new Tile('EPSG:4326', 0, 0, 0).toExtent('EPSG:4326'); assert.equal(-180, withValues.west); assert.equal(0, withValues.east); assert.equal(-90, withValues.south); assert.equal(90, withValues.north); }); - it('should convert TMS:3857 tile to EPSG:3857 extent like expected', function () { - const withValues = new Tile('TMS:3857', 0, 0, 0).toExtent('EPSG:3857'); + it('should convert EPSG:3857 tile to EPSG:3857 extent like expected', function () { + const withValues = new Tile('EPSG:3857', 0, 0, 0).toExtent('EPSG:3857'); assert.equal(-20037508.342789244, withValues.west); assert.equal(20037508.342789244, withValues.east); assert.equal(-20037508.342789244, withValues.south); assert.equal(20037508.342789244, withValues.north); }); - it('should convert TMS:3857 tile to EPSG:4326 extent like expected', function () { - const withValues = new Tile('TMS:3857', 0, 0, 0); + it('should convert EPSG:3857 tile to EPSG:4326 extent like expected', function () { + const withValues = new Tile('EPSG:3857', 0, 0, 0); const result = withValues.toExtent('EPSG:4326'); assert.equal(-180.00000000000003, result.west); assert.equal(180.00000000000003, result.east); @@ -35,8 +35,8 @@ describe('Tile', function () { }); it('should return expected offset using tiled extent', function () { - const withValues = new Tile('TMS:4326', zoom, row, col); - const parent = new Tile('TMS:4326', zoom - 2, row, col); + const withValues = new Tile('EPSG:4326', zoom, row, col); + const parent = new Tile('EPSG:4326', zoom - 2, row, col); const offset = withValues.offsetToParent(parent); assert.equal(offset.x, 0.5); assert.equal(offset.y, 0.5); @@ -45,7 +45,7 @@ describe('Tile', function () { }); it('should return expected tiled extent parent', function () { - const withValues = new Tile('TMS:4326', zoom, row, col); + const withValues = new Tile('EPSG:4326', zoom, row, col); const parent = withValues.tiledExtentParent(zoom - 2); assert.equal(parent.zoom, 3); assert.equal(parent.row, 5); @@ -53,7 +53,7 @@ describe('Tile', function () { }); it('should convert TMS extent values to string', function () { - const withValues = new Tile('TMS:4326', 0, 1, 2); + const withValues = new Tile('EPSG:4326', 0, 1, 2); const tostring = withValues.toString(','); const toValues = tostring.split(',').map(s => Number(s)); assert.equal(toValues[0], withValues.zoom); diff --git a/test/unit/tilemesh.js b/test/unit/tilemesh.js index efe12df674..bcdca3e261 100644 --- a/test/unit/tilemesh.js +++ b/test/unit/tilemesh.js @@ -23,7 +23,7 @@ FakeTileMesh.prototype.constructor = FakeTileMesh; FakeTileMesh.prototype.findCommonAncestor = TileMesh.prototype.findCommonAncestor; describe('TileMesh', function () { - const tile = new Tile('TMS:3857', 5, 10, 10); + const tile = new Tile('EPSG:3857', 5, 10, 10); const geom = new THREE.BufferGeometry(); geom.OBB = new OBB(); @@ -221,7 +221,7 @@ describe('TileMesh', function () { const tileMesh = new TileMesh(geom, material, planarlayer, tile.toExtent('EPSG:3857'), 0); const rasterNode = elevationLayer.setupRasterNode(tileMesh); const texture = new THREE.Texture(); - texture.extent = new Tile('TMS:3857', 4, 10, 10); + texture.extent = new Tile('EPSG:3857', 4, 10, 10); texture.image = { width: 3, height: 3,