@itwin/map-layers-formats 4.1.0-dev.5 → 4.1.0-dev.51
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.
- package/.rush/temp/operation/build/all.log +0 -2
- package/.rush/temp/operation/build/state.json +1 -1
- package/.rush/temp/operation/cover/all.log +12 -7
- package/.rush/temp/operation/cover/state.json +1 -1
- package/.rush/temp/operation/docs/all.log +1 -1
- package/.rush/temp/operation/docs/state.json +1 -1
- package/.rush/temp/package-deps_build.json +9 -9
- package/.rush/temp/package-deps_cover.json +9 -9
- package/.rush/temp/package-deps_docs.json +9 -9
- package/.rush/temp/shrinkwrap-deps.json +70 -80
- package/CHANGELOG.json +57 -0
- package/CHANGELOG.md +44 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js +3 -0
- package/lib/cjs/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts +3 -0
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.d.ts.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js +49 -11
- package/lib/cjs/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js +3 -3
- package/lib/cjs/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js +139 -7
- package/lib/cjs/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +1 -1
- package/lib/cjs/test/ArcGisFeature/Mocks.d.ts.map +1 -1
- package/lib/cjs/test/ArcGisFeature/Mocks.js +1 -1
- package/lib/cjs/test/ArcGisFeature/Mocks.js.map +1 -1
- package/lib/cjs/test/coverage/.nyc_output/6abfdfec-4bea-416d-b808-b4b6a26933a0.json +1 -0
- package/lib/cjs/test/coverage/.nyc_output/processinfo/6abfdfec-4bea-416d-b808-b4b6a26933a0.json +1 -0
- package/lib/cjs/test/coverage/.nyc_output/processinfo/e3a863c9-d93d-496e-88fc-7e67e520c8b6.json +1 -0
- package/lib/cjs/test/coverage/.nyc_output/processinfo/index.json +1 -1
- package/lib/cjs/test/coverage/cobertura-coverage.xml +294 -257
- package/lib/cjs/test/coverage/lcov-report/index.html +18 -18
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureFormat.ts.html +21 -9
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureJSON.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeaturePBF.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureProvider.ts.html +202 -76
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureQuery.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureReader.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureRenderer.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisFeatureResponse.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/ArcGisSymbologyRenderer.ts.html +13 -13
- package/lib/cjs/test/coverage/lcov-report/src/ArcGisFeature/index.html +26 -26
- package/lib/cjs/test/coverage/lcov-report/src/index.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/map-layers-formats.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov-report/src/mapLayersFormats.ts.html +1 -1
- package/lib/cjs/test/coverage/lcov.info +429 -388
- package/lib/cjs/tsconfig.tsbuildinfo +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js +4 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureFormat.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts +3 -0
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.d.ts.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js +49 -11
- package/lib/esm/ArcGisFeature/ArcGisFeatureProvider.js.map +1 -1
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js +3 -3
- package/lib/esm/ArcGisFeature/ArcGisSymbologyRenderer.js.map +1 -1
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js +140 -8
- package/lib/esm/test/ArcGisFeature/ArcGisFeatureProvider.test.js.map +1 -1
- package/lib/esm/test/ArcGisFeature/Mocks.d.ts.map +1 -1
- package/lib/esm/test/ArcGisFeature/Mocks.js +1 -1
- package/lib/esm/test/ArcGisFeature/Mocks.js.map +1 -1
- package/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/lib/test/junit_results.xml +61 -51
- package/map-layers-formats.build.cache.log +2 -0
- package/map-layers-formats.cover.log +103 -0
- package/{map-layers-formats.build.log → map-layers-formats.docs.log} +1 -1
- package/map-layers-formats.lint.error.log +1 -0
- package/map-layers-formats.lint.log +2 -0
- package/package.json +12 -12
- package/src/ArcGisFeature/ArcGisFeatureFormat.ts +5 -1
- package/src/ArcGisFeature/ArcGisFeatureProvider.ts +53 -11
- package/src/ArcGisFeature/ArcGisSymbologyRenderer.ts +3 -3
- package/src/test/ArcGisFeature/ArcGisFeatureProvider.test.ts +180 -8
- package/src/test/ArcGisFeature/Mocks.ts +1 -1
- package/lib/cjs/test/coverage/.nyc_output/97a409cb-0529-4dd9-9185-4c9a271c836a.json +0 -1
- package/lib/cjs/test/coverage/.nyc_output/processinfo/530a1eef-b22f-4875-a81e-1eabc667f480.json +0 -1
- package/lib/cjs/test/coverage/.nyc_output/processinfo/97a409cb-0529-4dd9-9185-4c9a271c836a.json +0 -1
- /package/lib/cjs/test/coverage/.nyc_output/{530a1eef-b22f-4875-a81e-1eabc667f480.json → e3a863c9-d93d-496e-88fc-7e67e520c8b6.json} +0 -0
|
@@ -15,24 +15,30 @@ import { base64StringToUint8Array, ByteStream, Logger } from "@itwin/core-bentle
|
|
|
15
15
|
import { ArcGisExtent, ArcGisFeatureFormat, ArcGisGeometry } from "../../ArcGisFeature/ArcGisFeatureQuery";
|
|
16
16
|
import { PhillyLandmarksDataset } from "./PhillyLandmarksDataset";
|
|
17
17
|
import { ArcGisFeatureResponse } from "../../ArcGisFeature/ArcGisFeatureResponse";
|
|
18
|
-
import { Point3d, Transform } from "@itwin/core-geometry";
|
|
18
|
+
import { Angle, Point3d, Transform } from "@itwin/core-geometry";
|
|
19
19
|
import { ArcGisFeaturePBF } from "../../ArcGisFeature/ArcGisFeaturePBF";
|
|
20
20
|
import { ArcGisFeatureJSON } from "../../ArcGisFeature/ArcGisFeatureJSON";
|
|
21
21
|
|
|
22
22
|
const expect = chai.expect;
|
|
23
23
|
chai.use(chaiAsPromised);
|
|
24
24
|
|
|
25
|
-
const esriFeatureSampleSource = {name: "dummyFeatureLayer", url: "https://dummy.com", formatId: ArcGisFeatureMapLayerFormat.formatId};
|
|
25
|
+
const esriFeatureSampleSource = {name: "dummyFeatureLayer", url: "https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer", formatId: ArcGisFeatureMapLayerFormat.formatId};
|
|
26
26
|
const pngTransparent1x1 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";
|
|
27
27
|
|
|
28
28
|
describe("ArcGisFeatureProvider", () => {
|
|
29
29
|
const sandbox = sinon.createSandbox();
|
|
30
|
+
let fetchStub: any;
|
|
31
|
+
|
|
32
|
+
beforeEach(async () => {
|
|
33
|
+
// Make sure no call to fetch is made, other it creates leaks
|
|
34
|
+
fetchStub = sandbox.stub((ArcGISImageryProvider.prototype as any), "fetch");
|
|
35
|
+
});
|
|
30
36
|
|
|
31
37
|
afterEach(async () => {
|
|
32
38
|
sandbox.restore();
|
|
33
39
|
});
|
|
34
40
|
|
|
35
|
-
it("should initialize with valid
|
|
41
|
+
it("should initialize with valid service metadata", async () => {
|
|
36
42
|
|
|
37
43
|
sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url: string, _formatId: string, _userName?: string, _password?: string, _ignoreCache?: boolean, _requireToken?: boolean) {
|
|
38
44
|
return {accessTokenRequired: false, content:NewYorkDataset.serviceCapabilities};
|
|
@@ -50,6 +56,172 @@ describe("ArcGisFeatureProvider", () => {
|
|
|
50
56
|
expect((provider as any)._maxDepthFromLod).to.equals(22);
|
|
51
57
|
});
|
|
52
58
|
|
|
59
|
+
it("should initialize and set cartoRange without making extra extent request", async () => {
|
|
60
|
+
|
|
61
|
+
sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url: string, _formatId: string, _userName?: string, _password?: string, _ignoreCache?: boolean, _requireToken?: boolean) {
|
|
62
|
+
return {accessTokenRequired: false, content:NewYorkDataset.serviceCapabilities};
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata" as any).callsFake(async function _(_layerId: unknown) {
|
|
66
|
+
return NewYorkDataset.streetsLayerCapabilities;
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const setCartoSpy = sandbox.spy(ArcGisFeatureProvider.prototype, "setCartoRangeFromExtentJson" as any);
|
|
70
|
+
const fetchLayerExtentSpy = sandbox.spy(ArcGisFeatureProvider.prototype, "fetchLayerExtent" as any);
|
|
71
|
+
|
|
72
|
+
const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
|
|
73
|
+
const provider = new ArcGisFeatureProvider(settings);
|
|
74
|
+
await provider.initialize();
|
|
75
|
+
|
|
76
|
+
expect(setCartoSpy.called).to.be.true;
|
|
77
|
+
|
|
78
|
+
expect(setCartoSpy.args[0][0]).to.be.equals(NewYorkDataset.streetsLayerCapabilities.extent);
|
|
79
|
+
expect(fetchLayerExtentSpy.called).to.be.false;
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it("should make an extra extent request when none available in layer metadata", async () => {
|
|
83
|
+
|
|
84
|
+
sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url: string, _formatId: string, _userName?: string, _password?: string, _ignoreCache?: boolean, _requireToken?: boolean) {
|
|
85
|
+
return {accessTokenRequired: false, content:NewYorkDataset.serviceCapabilities};
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
const setCartoSpy = sandbox.spy(ArcGisFeatureProvider.prototype, "setCartoRangeFromExtentJson" as any);
|
|
89
|
+
|
|
90
|
+
const layerExtent = {...NewYorkDataset.streetsLayerCapabilities.extent};
|
|
91
|
+
const fetchLayerExtentStub = sandbox.stub(ArcGisFeatureProvider.prototype, "fetchLayerExtent" as any).callsFake(async function _(_layerId: unknown) {
|
|
92
|
+
return layerExtent;
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const layerCapabilitiesNoExtent = {...NewYorkDataset.streetsLayerCapabilities, extent:null};
|
|
96
|
+
sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata" as any).callsFake(async function _(_layerId: unknown) {
|
|
97
|
+
return layerCapabilitiesNoExtent;
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
|
|
101
|
+
const provider = new ArcGisFeatureProvider(settings);
|
|
102
|
+
await provider.initialize();
|
|
103
|
+
|
|
104
|
+
expect(fetchLayerExtentStub.called).to.be.true;
|
|
105
|
+
expect(setCartoSpy.called).to.be.true;
|
|
106
|
+
expect(setCartoSpy.args[0][0]).to.be.equals(layerExtent);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("should make an extra extent request when none available in layer metadata", async () => {
|
|
110
|
+
|
|
111
|
+
sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url: string, _formatId: string, _userName?: string, _password?: string, _ignoreCache?: boolean, _requireToken?: boolean) {
|
|
112
|
+
return {accessTokenRequired: false, content:NewYorkDataset.serviceCapabilities};
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const setCartoSpy = sandbox.spy(ArcGisFeatureProvider.prototype, "setCartoRangeFromExtentJson" as any);
|
|
116
|
+
|
|
117
|
+
const layerExtent = {...NewYorkDataset.streetsLayerCapabilities.extent};
|
|
118
|
+
const fetchLayerExtentStub = sandbox.stub(ArcGisFeatureProvider.prototype, "fetchLayerExtent" as any).callsFake(async function _(_layerId: unknown) {
|
|
119
|
+
return layerExtent;
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const layerExtentBadSrs = {...NewYorkDataset.streetsLayerCapabilities};
|
|
123
|
+
layerExtentBadSrs.extent.spatialReference.wkid = 1234;
|
|
124
|
+
layerExtentBadSrs.extent.spatialReference.latestWkid = 1234;
|
|
125
|
+
sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata" as any).callsFake(async function _(_layerId: unknown) {
|
|
126
|
+
return layerExtentBadSrs;
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
|
|
130
|
+
const provider = new ArcGisFeatureProvider(settings);
|
|
131
|
+
await provider.initialize();
|
|
132
|
+
|
|
133
|
+
expect(fetchLayerExtentStub.called).to.be.true;
|
|
134
|
+
expect(setCartoSpy.called).to.be.true;
|
|
135
|
+
expect(setCartoSpy.args[0][0]).to.be.equals(layerExtent);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("should set cartoRange from Extent json", async () => {
|
|
139
|
+
|
|
140
|
+
const newYorkLayerExtent = NewYorkDataset.streetsLayerCapabilities.extent;
|
|
141
|
+
const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
|
|
142
|
+
const provider = new ArcGisFeatureProvider(settings);
|
|
143
|
+
|
|
144
|
+
const west = provider.getEPSG4326Lon(newYorkLayerExtent.xmin);
|
|
145
|
+
const south = provider.getEPSG4326Lat(newYorkLayerExtent.ymin);
|
|
146
|
+
const east = provider.getEPSG4326Lon(newYorkLayerExtent.xmax);
|
|
147
|
+
const north = provider.getEPSG4326Lat(newYorkLayerExtent.ymax);
|
|
148
|
+
|
|
149
|
+
(provider as any).setCartoRangeFromExtentJson(newYorkLayerExtent);
|
|
150
|
+
|
|
151
|
+
expect(provider.cartoRange).to.be.not.undefined;
|
|
152
|
+
const delta = 0.0000001;
|
|
153
|
+
expect(provider.cartoRange!.west * Angle.degreesPerRadian).to.approximately(west, delta);
|
|
154
|
+
expect(provider.cartoRange!.south * Angle.degreesPerRadian).to.approximately(south, delta);
|
|
155
|
+
expect(provider.cartoRange!.east * Angle.degreesPerRadian).to.approximately(east, delta);
|
|
156
|
+
expect(provider.cartoRange!.north * Angle.degreesPerRadian).to.approximately(north, delta);
|
|
157
|
+
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("should compose proper request to get extent", async () => {
|
|
161
|
+
|
|
162
|
+
fetchStub.restore(); // fetch is always stubbed by default, restore and provide our own stub
|
|
163
|
+
sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url: string, _formatId: string, _userName?: string, _password?: string, _ignoreCache?: boolean, _requireToken?: boolean) {
|
|
164
|
+
return {accessTokenRequired: false, content:NewYorkDataset.serviceCapabilities};
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const layerCapabilitiesNoExtent = {...NewYorkDataset.streetsLayerCapabilities};
|
|
168
|
+
sandbox.stub(ArcGisFeatureProvider.prototype, "getLayerMetadata" as any).callsFake(async function _(_layerId: unknown) {
|
|
169
|
+
return layerCapabilitiesNoExtent;
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
const referenceExtent = {extent: NewYorkDataset.streetsLayerCapabilities.extent};
|
|
173
|
+
const stub = sandbox.stub((ArcGISImageryProvider.prototype as any), "fetch").callsFake(async function _(_url: unknown, _options?: unknown) {
|
|
174
|
+
const test = {
|
|
175
|
+
headers: { "content-type" : "json"},
|
|
176
|
+
json: async () => {
|
|
177
|
+
return referenceExtent;
|
|
178
|
+
},
|
|
179
|
+
status: 200,
|
|
180
|
+
} as unknown; // By using unknown type, I can define parts of Response I really need
|
|
181
|
+
return (test as Response );
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
let layerId = 0;
|
|
185
|
+
let expectedUrl = `https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/${layerId}/query?where=1%3D1&outSR=3857&returnExtentOnly=true&f=json`;
|
|
186
|
+
let cachedExtent = (ArcGisFeatureProvider as any)._extentCache.get(expectedUrl);
|
|
187
|
+
expect(cachedExtent).to.be.undefined;
|
|
188
|
+
|
|
189
|
+
const settings = ImageMapLayerSettings.fromJSON(esriFeatureSampleSource);
|
|
190
|
+
const provider = new ArcGisFeatureProvider(settings);
|
|
191
|
+
await provider.initialize();
|
|
192
|
+
|
|
193
|
+
let fetchExtent = await (provider as any).fetchLayerExtent();
|
|
194
|
+
expect(fetchExtent).to.equals(referenceExtent.extent);
|
|
195
|
+
expect(stub.getCalls().length).to.equals(1);
|
|
196
|
+
expect(stub.args[0][0].toString()).to.be.equals(expectedUrl);
|
|
197
|
+
|
|
198
|
+
// Check if entry has been created in cache
|
|
199
|
+
cachedExtent = (ArcGisFeatureProvider as any)._extentCache.get(expectedUrl);
|
|
200
|
+
expect(cachedExtent).to.be.not.undefined;
|
|
201
|
+
expect(cachedExtent).to.equals(referenceExtent);
|
|
202
|
+
|
|
203
|
+
// Make sure cache is used
|
|
204
|
+
await (provider as any).fetchLayerExtent();
|
|
205
|
+
expect(stub.getCalls().length).to.equals(1);
|
|
206
|
+
|
|
207
|
+
// Force a different layerId, and check a new request has been made
|
|
208
|
+
layerId = 2;
|
|
209
|
+
expectedUrl = `https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/${layerId}/query?where=1%3D1&outSR=3857&returnExtentOnly=true&f=json`;
|
|
210
|
+
cachedExtent = (ArcGisFeatureProvider as any)._extentCache.get(expectedUrl);
|
|
211
|
+
expect(cachedExtent).to.be.undefined;
|
|
212
|
+
(provider as any)._layerId = layerId;
|
|
213
|
+
fetchExtent = await (provider as any).fetchLayerExtent();
|
|
214
|
+
expect(fetchExtent).to.equals(referenceExtent.extent);
|
|
215
|
+
expect(stub.getCalls().length).to.equals(2);
|
|
216
|
+
expect(stub.args[1][0].toString()).to.be.equals(expectedUrl);
|
|
217
|
+
|
|
218
|
+
// check cache has been updated with a new entry
|
|
219
|
+
cachedExtent = (ArcGisFeatureProvider as any)._extentCache.get(expectedUrl);
|
|
220
|
+
expect(cachedExtent).to.be.not.undefined;
|
|
221
|
+
expect(cachedExtent).to.equals(referenceExtent);
|
|
222
|
+
|
|
223
|
+
});
|
|
224
|
+
|
|
53
225
|
it("should not initialize with no service metadata", async () => {
|
|
54
226
|
|
|
55
227
|
sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url: string, _formatId: string, _userName?: string, _password?: string, _ignoreCache?: boolean, _requireToken?: boolean) {
|
|
@@ -297,7 +469,7 @@ describe("ArcGisFeatureProvider", () => {
|
|
|
297
469
|
latestWkid: 3857,
|
|
298
470
|
},
|
|
299
471
|
};
|
|
300
|
-
expect(url?.url).to.equals(
|
|
472
|
+
expect(url?.url).to.equals("https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/0/query?f=PBF&resultType=tile&maxRecordCountFactor=3&returnExceededLimitFeatures=false&outSR=102100&geometryType=esriGeometryEnvelope&geometry=%7B%22xmin%22%3A-20037508.34%2C%22ymin%22%3A-20037508.339999996%2C%22xmax%22%3A20037508.34%2C%22ymax%22%3A20037508.340000004%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D&units=esriSRUnit_Meter&inSR=102100");
|
|
301
473
|
expect(url?.envelope?.xmin).to.be.closeTo(extent.xmin, 0.01);
|
|
302
474
|
expect(url?.envelope?.ymin).to.be.closeTo(extent.ymin, 0.01);
|
|
303
475
|
expect(url?.envelope?.xmax).to.be.closeTo(extent.xmax, 0.01);
|
|
@@ -318,7 +490,7 @@ describe("ArcGisFeatureProvider", () => {
|
|
|
318
490
|
const provider2 = new ArcGisFeatureProvider(settings);
|
|
319
491
|
await provider2.initialize();
|
|
320
492
|
url = provider2.constructFeatureUrl(0,0,0, "PBF");
|
|
321
|
-
expect(url?.url).to.equals(
|
|
493
|
+
expect(url?.url).to.equals("https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/0/query?f=PBF&resultType=tile&maxRecordCountFactor=3&returnExceededLimitFeatures=false&outSR=102100&geometryType=esriGeometryEnvelope&geometry=%7B%22xmin%22%3A-20037508.34%2C%22ymin%22%3A-20037508.339999996%2C%22xmax%22%3A20037508.34%2C%22ymax%22%3A20037508.340000004%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D&units=esriSRUnit_Meter&inSR=102100&quantizationParameters=%7B%22mode%22%3A%22view%22%2C%22originPosition%22%3A%22upperLeft%22%2C%22tolerance%22%3A78271.516953125%2C%22extent%22%3A%7B%22xmin%22%3A-20037508.34%2C%22ymin%22%3A-20037508.339999996%2C%22xmax%22%3A20037508.34%2C%22ymax%22%3A20037508.340000004%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%7D");
|
|
322
494
|
expect(url?.envelope?.xmin).to.be.closeTo(extent.xmin, 0.01);
|
|
323
495
|
expect(url?.envelope?.ymin).to.be.closeTo(extent.ymin, 0.01);
|
|
324
496
|
expect(url?.envelope?.xmax).to.be.closeTo(extent.xmax, 0.01);
|
|
@@ -343,7 +515,7 @@ describe("ArcGisFeatureProvider", () => {
|
|
|
343
515
|
const provider3 = new ArcGisFeatureProvider(settings);
|
|
344
516
|
await provider3.initialize();
|
|
345
517
|
url = provider3.constructFeatureUrl(0,0,0, "PBF", overrideGeom);
|
|
346
|
-
expect(url?.url).to.equals(
|
|
518
|
+
expect(url?.url).to.equals("https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/0/query?f=PBF&resultType=tile&maxRecordCountFactor=3&returnExceededLimitFeatures=false&outSR=102100&geometryType=esriGeometryEnvelope&geometry=%7B%22xmin%22%3A-50%2C%22ymin%22%3A-50%2C%22xmax%22%3A50%2C%22ymax%22%3A50%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D&units=esriSRUnit_Meter&inSR=102100&quantizationParameters=%7B%22mode%22%3A%22view%22%2C%22originPosition%22%3A%22upperLeft%22%2C%22tolerance%22%3A78271.516953125%2C%22extent%22%3A%7B%22xmin%22%3A-20037508.34%2C%22ymin%22%3A-20037508.339999996%2C%22xmax%22%3A20037508.34%2C%22ymax%22%3A20037508.340000004%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%7D");
|
|
347
519
|
expect(url?.envelope?.xmin).to.be.closeTo((overrideGeom.geom as ArcGisExtent).xmin, 0.01);
|
|
348
520
|
expect(url?.envelope?.ymin).to.be.closeTo((overrideGeom.geom as ArcGisExtent).ymin, 0.01);
|
|
349
521
|
expect(url?.envelope?.xmax).to.be.closeTo((overrideGeom.geom as ArcGisExtent).xmax, 0.01);
|
|
@@ -353,7 +525,7 @@ describe("ArcGisFeatureProvider", () => {
|
|
|
353
525
|
|
|
354
526
|
// Now test with a different tolerance value
|
|
355
527
|
url = provider3.constructFeatureUrl(0,0,0, "PBF", overrideGeom, undefined, 10);
|
|
356
|
-
expect(url?.url).to.equals(
|
|
528
|
+
expect(url?.url).to.equals("https://dummy.com/SomeGuid/ArcGIS/rest/services/SomeService/FeatureServer/0/query?f=PBF&resultType=tile&maxRecordCountFactor=3&returnExceededLimitFeatures=false&outSR=102100&geometryType=esriGeometryEnvelope&geometry=%7B%22xmin%22%3A-50%2C%22ymin%22%3A-50%2C%22xmax%22%3A50%2C%22ymax%22%3A50%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D&units=esriSRUnit_Meter&inSR=102100&quantizationParameters=%7B%22mode%22%3A%22view%22%2C%22originPosition%22%3A%22upperLeft%22%2C%22tolerance%22%3A78271.516953125%2C%22extent%22%3A%7B%22xmin%22%3A-20037508.34%2C%22ymin%22%3A-20037508.339999996%2C%22xmax%22%3A20037508.34%2C%22ymax%22%3A20037508.340000004%2C%22spatialReference%22%3A%7B%22wkid%22%3A102100%2C%22latestWkid%22%3A3857%7D%7D%7D&distance=782715.16953125");
|
|
357
529
|
expect(url?.envelope?.xmin).to.be.closeTo((overrideGeom.geom as ArcGisExtent).xmin, 0.01);
|
|
358
530
|
expect(url?.envelope?.ymin).to.be.closeTo((overrideGeom.geom as ArcGisExtent).ymin, 0.01);
|
|
359
531
|
expect(url?.envelope?.xmax).to.be.closeTo((overrideGeom.geom as ArcGisExtent).xmax, 0.01);
|
|
@@ -416,6 +588,7 @@ describe("ArcGisFeatureProvider", () => {
|
|
|
416
588
|
sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url: string, _formatId: string, _userName?: string, _password?: string, _ignoreCache?: boolean, _requireToken?: boolean) {
|
|
417
589
|
return {accessTokenRequired: false, content:{currentVersion: 11, capabilities: "Query"}};
|
|
418
590
|
});
|
|
591
|
+
fetchStub.restore(); // fetch is always stubbed by default, restore and provide our own stub
|
|
419
592
|
sandbox.stub((ArcGISImageryProvider.prototype as any), "fetch").callsFake(async function _(_url: unknown, _options?: unknown) {
|
|
420
593
|
const test = {
|
|
421
594
|
headers: { "content-type" : "pbf"},
|
|
@@ -786,7 +959,6 @@ describe("ArcGisFeatureProvider", () => {
|
|
|
786
959
|
sandbox.stub(ArcGisUtilities, "getServiceJson").callsFake(async function _(_url: string, _formatId: string, _userName?: string, _password?: string, _ignoreCache?: boolean, _requireToken?: boolean) {
|
|
787
960
|
return {accessTokenRequired: false, content:{capabilities: "Query"}};
|
|
788
961
|
});
|
|
789
|
-
const fetchStub = sandbox.stub((ArcGISImageryProvider.prototype as any), "fetch");
|
|
790
962
|
|
|
791
963
|
sandbox.stub(ArcGisFeatureProvider.prototype, "constructFeatureUrl").callsFake(function _(_row: number, _column: number, _zoomLevel: number, _format: ArcGisFeatureFormat, _geomOverride?: ArcGisGeometry, _outFields?: string, _tolerance?: number, _returnGeometry?: boolean) {
|
|
792
964
|
return {url: settings.url};
|
|
@@ -16,4 +16,4 @@ export const fakeContext = ({
|
|
|
16
16
|
|
|
17
17
|
} as CanvasRenderingContext2D);
|
|
18
18
|
|
|
19
|
-
export const esriFeatureSampleSource = {name: "dummyFeatureLayer", url: "https://
|
|
19
|
+
export const esriFeatureSampleSource = {name: "dummyFeatureLayer", url: "https://services7.arcgis.com/nZ2Vb4CUwdo9AIiQ/ArcGIS/rest/services/PhillyRailLines/FeatureServer", formatId: ArcGisFeatureMapLayerFormat.formatId};
|