Use standard tile coords

This commit is contained in:
Tim Schaub
2018-11-20 15:28:24 -07:00
parent 37c987de0a
commit e9a30c5cb7
29 changed files with 241 additions and 229 deletions

View File

@@ -17,7 +17,7 @@ describe('ol.source.TileArcGISRest', function() {
it('returns a tile with the expected URL', function() {
const source = new TileArcGISRest(options);
const tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
const tile = source.getTile(3, 2, 6, 1, getProjection('EPSG:3857'));
expect(tile).to.be.an(ImageTile);
const uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
@@ -39,7 +39,7 @@ describe('ol.source.TileArcGISRest', function() {
it('returns a non floating point DPI value', function() {
const source = new TileArcGISRest(options);
const tile = source.getTile(3, 2, -7, 1.12, getProjection('EPSG:3857'));
const tile = source.getTile(3, 2, 6, 1.12, getProjection('EPSG:3857'));
const uri = new URL(tile.src_);
const queryData = uri.searchParams;
expect(queryData.get('DPI')).to.be('101');
@@ -48,7 +48,7 @@ describe('ol.source.TileArcGISRest', function() {
it('takes DPI from params if specified', function() {
options.params.DPI = 96;
const source = new TileArcGISRest(options);
const tile = source.getTile(3, 2, -7, 1.12, getProjection('EPSG:3857'));
const tile = source.getTile(3, 2, 6, 1.12, getProjection('EPSG:3857'));
const uri = new URL(tile.src_);
const queryData = uri.searchParams;
expect(queryData.get('DPI')).to.be('108');
@@ -60,7 +60,7 @@ describe('ol.source.TileArcGISRest', function() {
options.urls = ['http://test1.com/MapServer', 'http://test2.com/MapServer'];
const source = new TileArcGISRest(options);
const tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
const tile = source.getTile(3, 2, 6, 1, getProjection('EPSG:3857'));
expect(tile).to.be.an(ImageTile);
const uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
@@ -83,7 +83,7 @@ describe('ol.source.TileArcGISRest', function() {
it('returns a tile with the expected URL for ImageServer', function() {
options.url = 'http://example.com/ImageServer';
const source = new TileArcGISRest(options);
const tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
const tile = source.getTile(3, 2, 6, 1, getProjection('EPSG:3857'));
expect(tile).to.be.an(ImageTile);
const uri = new URL(tile.src_);
expect(uri.protocol).to.be('http:');
@@ -106,7 +106,7 @@ describe('ol.source.TileArcGISRest', function() {
options.params.FORMAT = 'png';
options.params.TRANSPARENT = false;
const source = new TileArcGISRest(options);
const tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
const tile = source.getTile(3, 2, 2, 1, getProjection('EPSG:4326'));
const uri = new URL(tile.src_);
const queryData = uri.searchParams;
expect(queryData.get('FORMAT')).to.be('png');
@@ -116,7 +116,7 @@ describe('ol.source.TileArcGISRest', function() {
it('allows adding rest option', function() {
options.params.LAYERS = 'show:1,3,4';
const source = new TileArcGISRest(options);
const tile = source.getTile(3, 2, -3, 1, getProjection('EPSG:4326'));
const tile = source.getTile(3, 2, 2, 1, getProjection('EPSG:4326'));
const uri = new URL(tile.src_);
const queryData = uri.searchParams;
expect(queryData.get('LAYERS')).to.be('show:1,3,4');
@@ -129,7 +129,7 @@ describe('ol.source.TileArcGISRest', function() {
const source = new TileArcGISRest(options);
source.updateParams({'TEST': 'value'});
const tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
const tile = source.getTile(3, 2, 6, 1, getProjection('EPSG:3857'));
const uri = new URL(tile.src_);
const queryData = uri.searchParams;
expect(queryData.get('TEST')).to.be('value');
@@ -141,7 +141,7 @@ describe('ol.source.TileArcGISRest', function() {
const source = new TileArcGISRest(options);
source.updateParams({'TEST': 'newValue'});
const tile = source.getTile(3, 2, -7, 1, getProjection('EPSG:3857'));
const tile = source.getTile(3, 2, 6, 1, getProjection('EPSG:3857'));
const uri = new URL(tile.src_);
const queryData = uri.searchParams;
expect(queryData.get('TEST')).to.be('newValue');