From 430267a175d889bca311d5af3bfd2cdc69f1b48f Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Sun, 6 Jun 2021 15:57:08 +0100 Subject: [PATCH 1/5] ensure srid is numeric, otherwise use entire code --- src/ol/source/ImageArcGISRest.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ol/source/ImageArcGISRest.js b/src/ol/source/ImageArcGISRest.js index 1d682a9f57..41d7112ecd 100644 --- a/src/ol/source/ImageArcGISRest.js +++ b/src/ol/source/ImageArcGISRest.js @@ -28,6 +28,8 @@ import {containsExtent, getHeight, getWidth} from '../extent.js'; * https://developers.arcgis.com/rest/services-reference/export-map.htm * for further reference. * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection. + * The projection code must contain a numeric end portion separated by : + * or the entire code must form a valid ArcGIS SpatialReference definition. * @property {number} [ratio=1.5] Ratio. `1` means image requests are the size of the map viewport, * `2` means twice the size of the map viewport, and so on. * @property {Array} [resolutions] Resolutions. If specified, requests will be made for @@ -238,7 +240,9 @@ class ImageArcGISRest extends ImageSource { */ getRequestUrl_(extent, size, pixelRatio, projection, params) { // ArcGIS Server only wants the numeric portion of the projection ID. - const srid = projection.getCode().split(':').pop(); + // (if there is no numeric portion the entire projection code must + // form a valid ArcGIS SpatialReference definition). + const srid = projection.getCode().split(/:(?=\d+$)/)).pop(); params['SIZE'] = size[0] + ',' + size[1]; params['BBOX'] = extent.join(','); From fcdf7d02acc791cc540a6f65c765e7b595cef99a Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Sun, 6 Jun 2021 16:03:31 +0100 Subject: [PATCH 2/5] ensure srid is numeric, otherwise use entire code --- src/ol/source/TileArcGISRest.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ol/source/TileArcGISRest.js b/src/ol/source/TileArcGISRest.js index 231a0b84ec..15b298fdbc 100644 --- a/src/ol/source/TileArcGISRest.js +++ b/src/ol/source/TileArcGISRest.js @@ -33,6 +33,8 @@ import {hash as tileCoordHash} from '../tilecoord.js'; * extent, the grid will be based on that; if not, a grid based on a global * extent with origin at 0,0 will be used. * @property {import("../proj.js").ProjectionLike} [projection] Projection. Default is the view projection. + * The projection code must contain a numeric end portion separated by : + * or the entire code must form a valid ArcGIS SpatialReference definition. * @property {number} [reprojectionErrorThreshold=0.5] Maximum allowed reprojection error (in pixels). * Higher values can increase reprojection performance, but decrease precision. * @property {import("../Tile.js").LoadFunction} [tileLoadFunction] Optional function to load a tile given a URL. @@ -150,7 +152,9 @@ class TileArcGISRest extends TileImage { } // ArcGIS Server only wants the numeric portion of the projection ID. - const srid = projection.getCode().split(':').pop(); + // (if there is no numeric portion the entire projection code must + // form a valid ArcGIS SpatialReference definition). + const srid = projection.getCode().split(/:(?=\d+$)/).pop(); params['SIZE'] = tileSize[0] + ',' + tileSize[1]; params['BBOX'] = tileExtent.join(','); From 1bb75897eee83c27bb9adb6a63ffd28ae28ff765 Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Sun, 6 Jun 2021 18:00:16 +0100 Subject: [PATCH 3/5] ensure srid is numeric, otherwise use entire code removed duplicate ) --- src/ol/source/ImageArcGISRest.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ol/source/ImageArcGISRest.js b/src/ol/source/ImageArcGISRest.js index 41d7112ecd..c8840fd1ed 100644 --- a/src/ol/source/ImageArcGISRest.js +++ b/src/ol/source/ImageArcGISRest.js @@ -242,7 +242,7 @@ class ImageArcGISRest extends ImageSource { // ArcGIS Server only wants the numeric portion of the projection ID. // (if there is no numeric portion the entire projection code must // form a valid ArcGIS SpatialReference definition). - const srid = projection.getCode().split(/:(?=\d+$)/)).pop(); + const srid = projection.getCode().split(/:(?=\d+$)/).pop(); params['SIZE'] = size[0] + ',' + size[1]; params['BBOX'] = extent.join(','); From bb8c82b98c973af803c66c3587b29f5c4ef0af32 Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Sun, 6 Jun 2021 18:09:45 +0100 Subject: [PATCH 4/5] ensure srid is numeric, otherwise use entire code lint --- src/ol/source/ImageArcGISRest.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ol/source/ImageArcGISRest.js b/src/ol/source/ImageArcGISRest.js index c8840fd1ed..518a560387 100644 --- a/src/ol/source/ImageArcGISRest.js +++ b/src/ol/source/ImageArcGISRest.js @@ -242,7 +242,10 @@ class ImageArcGISRest extends ImageSource { // ArcGIS Server only wants the numeric portion of the projection ID. // (if there is no numeric portion the entire projection code must // form a valid ArcGIS SpatialReference definition). - const srid = projection.getCode().split(/:(?=\d+$)/).pop(); + const srid = projection + .getCode() + .split(/:(?=\d+$)/) + .pop(); params['SIZE'] = size[0] + ',' + size[1]; params['BBOX'] = extent.join(','); From ec5864a41a7f7879ae83c4394cec16361b02b655 Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Sun, 6 Jun 2021 18:09:49 +0100 Subject: [PATCH 5/5] ensure srid is numeric, otherwise use entire code lint --- src/ol/source/TileArcGISRest.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ol/source/TileArcGISRest.js b/src/ol/source/TileArcGISRest.js index 15b298fdbc..ed76984d4a 100644 --- a/src/ol/source/TileArcGISRest.js +++ b/src/ol/source/TileArcGISRest.js @@ -154,7 +154,10 @@ class TileArcGISRest extends TileImage { // ArcGIS Server only wants the numeric portion of the projection ID. // (if there is no numeric portion the entire projection code must // form a valid ArcGIS SpatialReference definition). - const srid = projection.getCode().split(/:(?=\d+$)/).pop(); + const srid = projection + .getCode() + .split(/:(?=\d+$)/) + .pop(); params['SIZE'] = tileSize[0] + ',' + tileSize[1]; params['BBOX'] = tileExtent.join(',');