@open-pioneer/ogc-features 0.1.0
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/CHANGELOG.md +7 -0
- package/LICENSE +202 -0
- package/OffsetStrategy.d.ts +10 -0
- package/OffsetStrategy.js +67 -0
- package/OffsetStrategy.js.map +1 -0
- package/OgcFeatureSourceFactory.d.ts +77 -0
- package/OgcFeatureSourceFactory.js +125 -0
- package/OgcFeatureSourceFactory.js.map +1 -0
- package/README.md +54 -0
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/package.json +28 -0
- package/requestUtils.d.ts +25 -0
- package/requestUtils.js +53 -0
- package/requestUtils.js.map +1 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FeatureLike } from "ol/Feature";
|
|
2
|
+
import { LoadFeatureOptions } from "./OgcFeatureSourceFactory";
|
|
3
|
+
/** @internal */
|
|
4
|
+
export interface CollectionInfos {
|
|
5
|
+
/** True if features can be requested in pages using offset & limit parameters. */
|
|
6
|
+
supportsOffsetStrategy: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function getCollectionInfos(collectionsItemsUrl: string): Promise<CollectionInfos>;
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare function loadAllFeaturesWithOffset(options: LoadFeatureOptions): Promise<FeatureLike[]>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { loadPages } from './OgcFeatureSourceFactory.js';
|
|
2
|
+
import { createOffsetURL, getNextURL } from './requestUtils.js';
|
|
3
|
+
|
|
4
|
+
async function getCollectionInfos(collectionsItemsUrl) {
|
|
5
|
+
const infos = {
|
|
6
|
+
supportsOffsetStrategy: false
|
|
7
|
+
};
|
|
8
|
+
const url = new URL(collectionsItemsUrl);
|
|
9
|
+
url.searchParams.set("limit", "1");
|
|
10
|
+
url.searchParams.set("f", "json");
|
|
11
|
+
const response = await fetch(url.toString(), {
|
|
12
|
+
headers: {
|
|
13
|
+
Accept: "application/geo+json"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
if (response.status !== 200) {
|
|
17
|
+
throw new Error(`Failed to probe collection information (status code ${response.status})`);
|
|
18
|
+
}
|
|
19
|
+
const jsonResp = await response.json();
|
|
20
|
+
const nextUrl = getNextURL(jsonResp.links);
|
|
21
|
+
if (!nextUrl) {
|
|
22
|
+
return infos;
|
|
23
|
+
}
|
|
24
|
+
const parsedURL = new URL(nextUrl);
|
|
25
|
+
const hasOffset = parsedURL.searchParams.has("offset");
|
|
26
|
+
infos.supportsOffsetStrategy = hasOffset;
|
|
27
|
+
return infos;
|
|
28
|
+
}
|
|
29
|
+
async function loadAllFeaturesWithOffset(options) {
|
|
30
|
+
const { fullURL, featureFormat, signal, addFeatures, queryFeatures } = options;
|
|
31
|
+
const pageSize = options.limit;
|
|
32
|
+
const maxConcurrency = options.maxConcurrentRequests;
|
|
33
|
+
let startOffset = 0;
|
|
34
|
+
let currentUrl = fullURL;
|
|
35
|
+
const allFeatures = [];
|
|
36
|
+
let totalFeatures;
|
|
37
|
+
while (currentUrl) {
|
|
38
|
+
let pagesInIteration;
|
|
39
|
+
if (totalFeatures == void 0) {
|
|
40
|
+
pagesInIteration = maxConcurrency;
|
|
41
|
+
} else {
|
|
42
|
+
pagesInIteration = Math.ceil((totalFeatures - startOffset) / pageSize);
|
|
43
|
+
}
|
|
44
|
+
pagesInIteration = Math.max(1, Math.min(pagesInIteration, maxConcurrency));
|
|
45
|
+
const urls = [];
|
|
46
|
+
for (let page = 0; page < pagesInIteration; ++page) {
|
|
47
|
+
urls.push(createOffsetURL(fullURL, startOffset, pageSize));
|
|
48
|
+
startOffset += pageSize;
|
|
49
|
+
}
|
|
50
|
+
const allFeatureResp = await loadPages(
|
|
51
|
+
urls,
|
|
52
|
+
featureFormat,
|
|
53
|
+
signal,
|
|
54
|
+
addFeatures,
|
|
55
|
+
queryFeatures
|
|
56
|
+
);
|
|
57
|
+
allFeatures.push(...allFeatureResp.features);
|
|
58
|
+
currentUrl = allFeatureResp.nextURL;
|
|
59
|
+
if (allFeatureResp.numberMatched != null) {
|
|
60
|
+
totalFeatures = allFeatureResp.numberMatched;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return allFeatures;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export { getCollectionInfos, loadAllFeaturesWithOffset };
|
|
67
|
+
//# sourceMappingURL=OffsetStrategy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OffsetStrategy.js","sources":["OffsetStrategy.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { FeatureLike } from \"ol/Feature\";\nimport { LoadFeatureOptions, loadPages } from \"./OgcFeatureSourceFactory\";\nimport { createOffsetURL, getNextURL } from \"./requestUtils\";\n\n/** @internal */\nexport interface CollectionInfos {\n /** True if features can be requested in pages using offset & limit parameters. */\n supportsOffsetStrategy: boolean;\n}\n\nexport async function getCollectionInfos(collectionsItemsUrl: string): Promise<CollectionInfos> {\n const infos: CollectionInfos = {\n supportsOffsetStrategy: false\n };\n\n const url = new URL(collectionsItemsUrl);\n url.searchParams.set(\"limit\", \"1\");\n url.searchParams.set(\"f\", \"json\");\n const response = await fetch(url.toString(), {\n headers: {\n Accept: \"application/geo+json\"\n }\n });\n if (response.status !== 200) {\n throw new Error(`Failed to probe collection information (status code ${response.status})`);\n }\n\n const jsonResp = await response.json();\n const nextUrl = getNextURL(jsonResp.links);\n if (!nextUrl) {\n return infos;\n }\n\n const parsedURL = new URL(nextUrl);\n const hasOffset = parsedURL.searchParams.has(\"offset\");\n infos.supportsOffsetStrategy = hasOffset;\n return infos;\n}\n\n/** @internal */\nexport async function loadAllFeaturesWithOffset(\n options: LoadFeatureOptions\n): Promise<FeatureLike[]> {\n const { fullURL, featureFormat, signal, addFeatures, queryFeatures } = options;\n const pageSize = options.limit;\n const maxConcurrency = options.maxConcurrentRequests;\n\n let startOffset = 0;\n let currentUrl: string | undefined = fullURL;\n const allFeatures: FeatureLike[] = [];\n let totalFeatures: number | undefined;\n while (currentUrl) {\n let pagesInIteration: number;\n if (totalFeatures == undefined) {\n // We don't know the actual size of the result set yet.\n pagesInIteration = maxConcurrency;\n } else {\n pagesInIteration = Math.ceil((totalFeatures - startOffset) / pageSize);\n }\n pagesInIteration = Math.max(1, Math.min(pagesInIteration, maxConcurrency));\n\n const urls: string[] = [];\n for (let page = 0; page < pagesInIteration; ++page) {\n urls.push(createOffsetURL(fullURL, startOffset, pageSize));\n startOffset += pageSize;\n }\n\n const allFeatureResp = await loadPages(\n urls,\n featureFormat,\n signal,\n addFeatures,\n queryFeatures\n );\n\n allFeatures.push(...allFeatureResp.features);\n currentUrl = allFeatureResp.nextURL;\n if (allFeatureResp.numberMatched != null) {\n totalFeatures = allFeatureResp.numberMatched;\n }\n }\n while (currentUrl !== undefined);\n return allFeatures;\n}\n"],"names":[],"mappings":";;;AAYA,eAAsB,mBAAmB,mBAAuD,EAAA;AAC5F,EAAA,MAAM,KAAyB,GAAA;AAAA,IAC3B,sBAAwB,EAAA,KAAA;AAAA,GAC5B,CAAA;AAEA,EAAM,MAAA,GAAA,GAAM,IAAI,GAAA,CAAI,mBAAmB,CAAA,CAAA;AACvC,EAAI,GAAA,CAAA,YAAA,CAAa,GAAI,CAAA,OAAA,EAAS,GAAG,CAAA,CAAA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{ Geometry } from "ol/geom";
|
|
4
|
+
import { AttributionLike } from "ol/source/Source";
|
|
5
|
+
import VectorSource, { Options } from "ol/source/Vector";
|
|
6
|
+
import { CollectionInfos, getCollectionInfos } from "./OffsetStrategy";
|
|
7
|
+
import { FeatureResponse, queryFeatures } from "./requestUtils";
|
|
8
|
+
export interface OgcFeatureSourceOptions {
|
|
9
|
+
/** The base-URL right to the "/collections"-part */
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
/** The collection-ID */
|
|
12
|
+
collectionId: string;
|
|
13
|
+
/** the URL to the EPSG-Code, e.g. http://www.opengis.net/def/crs/EPSG/0/25832 */
|
|
14
|
+
crs: string;
|
|
15
|
+
/**
|
|
16
|
+
* The maximum number of features to fetch within a single request.
|
|
17
|
+
* Corresponds to the `limit` parameter in the URL.
|
|
18
|
+
*
|
|
19
|
+
* When the `offset` strategy is used for feature fetching, the limit
|
|
20
|
+
* is used for the page size
|
|
21
|
+
*
|
|
22
|
+
* Default limit is 5000 for Next-Strategy and 2500 for Offset-Strategy
|
|
23
|
+
*/
|
|
24
|
+
limit?: number;
|
|
25
|
+
/** The maximum number of concurrent requests. Defaults to `6`. */
|
|
26
|
+
maxConcurrentRequests?: number;
|
|
27
|
+
/** Optional attribution for the layer (e.g. copyright hints). */
|
|
28
|
+
attributions?: AttributionLike | undefined;
|
|
29
|
+
/** Optional additional options for the VectorSource. */
|
|
30
|
+
additionalOptions?: Options<Feature<Geometry>>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* This function creates an OpenLayers VectorSource for OGC Features API services to be used inside
|
|
34
|
+
* an OpenLayers VectorLayer.
|
|
35
|
+
*
|
|
36
|
+
* @param options Options for the vector source.
|
|
37
|
+
*/
|
|
38
|
+
export declare function createVectorSource(options: OgcFeatureSourceOptions): VectorSource;
|
|
39
|
+
/**
|
|
40
|
+
* @internal
|
|
41
|
+
* Creates the actual vector source.
|
|
42
|
+
* Exported for testing.
|
|
43
|
+
* Exposes `queryFeatures`, `addFeatures` and `getCollectionInfos` for easier testing.
|
|
44
|
+
*/
|
|
45
|
+
export declare function _createVectorSource(options: OgcFeatureSourceOptions, queryFeaturesParam: QueryFeaturesFunc | undefined, addFeaturesParam: AddFeaturesFunc | undefined, getCollectionInfosParam: GetCollectionInfosFunc | undefined): VectorSource;
|
|
46
|
+
/** @internal **/
|
|
47
|
+
type QueryFeaturesFunc = typeof queryFeatures;
|
|
48
|
+
/** @internal **/
|
|
49
|
+
type GetCollectionInfosFunc = typeof getCollectionInfos;
|
|
50
|
+
/** @internal **/
|
|
51
|
+
type AddFeaturesFunc = (features: FeatureLike[]) => void;
|
|
52
|
+
/** @internal **/
|
|
53
|
+
export interface LoadFeatureOptions {
|
|
54
|
+
fullURL: string;
|
|
55
|
+
featureFormat: FeatureFormat;
|
|
56
|
+
queryFeatures: QueryFeaturesFunc;
|
|
57
|
+
addFeatures: AddFeaturesFunc;
|
|
58
|
+
limit: number;
|
|
59
|
+
maxConcurrentRequests: number;
|
|
60
|
+
signal?: AbortSignal;
|
|
61
|
+
collectionInfos?: CollectionInfos;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* @internal
|
|
65
|
+
* Fetches features by following the `next` links in the server's response.
|
|
66
|
+
*/
|
|
67
|
+
export declare function loadAllFeaturesNextStrategy(options: Omit<LoadFeatureOptions, "offsetRequestProps" | "collectionInfos">): Promise<FeatureLike[]>;
|
|
68
|
+
export declare function loadFeatures(requestUrl: string, featureFormat: FeatureFormat, signal: AbortSignal | undefined, addFeaturesFunc: AddFeaturesFunc, queryFeaturesFunc?: QueryFeaturesFunc): Promise<FeatureResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* Loads features from multiple urls in parallel.
|
|
71
|
+
* The URLs should represent pages of the same result set.
|
|
72
|
+
* The `nextURL` of the last page (if any) is returned from this function.
|
|
73
|
+
*
|
|
74
|
+
* @internal
|
|
75
|
+
*/
|
|
76
|
+
export declare function loadPages(allUrls: Array<string>, featureFormat: FeatureFormat, signal: AbortSignal | undefined, addFeaturesFunc: AddFeaturesFunc, queryFeaturesFunc?: QueryFeaturesFunc): Promise<FeatureResponse>;
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { createLogger, isAbortError } from '@open-pioneer/core';
|
|
2
|
+
import GeoJSON from 'ol/format/GeoJSON';
|
|
3
|
+
import { bbox } from 'ol/loadingstrategy';
|
|
4
|
+
import VectorSource from 'ol/source/Vector';
|
|
5
|
+
import { loadAllFeaturesWithOffset, getCollectionInfos } from './OffsetStrategy.js';
|
|
6
|
+
import { createCollectionRequestUrl, queryFeatures } from './requestUtils.js';
|
|
7
|
+
|
|
8
|
+
const LOG = createLogger("ogc-features:OgcFeatureSourceFactory");
|
|
9
|
+
const DEFAULT_LIMIT = 5e3;
|
|
10
|
+
const DEFAULT_CONCURRENTY = 6;
|
|
11
|
+
function createVectorSource(options) {
|
|
12
|
+
return _createVectorSource(options, void 0, void 0, void 0);
|
|
13
|
+
}
|
|
14
|
+
function _createVectorSource(options, queryFeaturesParam, addFeaturesParam, getCollectionInfosParam) {
|
|
15
|
+
const collectionItemsURL = `${options.baseUrl}/collections/${options.collectionId}/items?`;
|
|
16
|
+
const vectorSrc = new VectorSource({
|
|
17
|
+
format: new GeoJSON(),
|
|
18
|
+
strategy: bbox,
|
|
19
|
+
attributions: options.attributions,
|
|
20
|
+
...options.additionalOptions
|
|
21
|
+
});
|
|
22
|
+
const queryFeaturesFunc = queryFeaturesParam ?? queryFeatures;
|
|
23
|
+
const getCollectionInfosFunc = getCollectionInfosParam ?? getCollectionInfos;
|
|
24
|
+
const addFeaturesFunc = addFeaturesParam || function(features) {
|
|
25
|
+
LOG.debug(`Adding ${features.length} features`);
|
|
26
|
+
vectorSrc.addFeatures(features);
|
|
27
|
+
};
|
|
28
|
+
let abortController;
|
|
29
|
+
let collectionInfosPromise;
|
|
30
|
+
const loaderFunction = async (extent, _, __, success, failure) => {
|
|
31
|
+
collectionInfosPromise ??= getCollectionInfosFunc(collectionItemsURL);
|
|
32
|
+
let collectionInfos;
|
|
33
|
+
try {
|
|
34
|
+
collectionInfos = await collectionInfosPromise;
|
|
35
|
+
} catch (e) {
|
|
36
|
+
LOG.error("Failed to retrieve collection information", e);
|
|
37
|
+
failure?.();
|
|
38
|
+
collectionInfosPromise = void 0;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
abortController?.abort("Extent changed");
|
|
42
|
+
abortController = new AbortController();
|
|
43
|
+
const fullURL = createCollectionRequestUrl(collectionItemsURL, extent, options.crs);
|
|
44
|
+
const strategy = collectionInfos?.supportsOffsetStrategy ? "offset" : "next";
|
|
45
|
+
try {
|
|
46
|
+
const features = await loadAllFeatures(strategy, {
|
|
47
|
+
fullURL: fullURL.toString(),
|
|
48
|
+
featureFormat: vectorSrc.getFormat(),
|
|
49
|
+
// TODO
|
|
50
|
+
queryFeatures: queryFeaturesFunc,
|
|
51
|
+
addFeatures: addFeaturesFunc,
|
|
52
|
+
limit: options.limit ?? DEFAULT_LIMIT,
|
|
53
|
+
maxConcurrentRequests: options.maxConcurrentRequests ?? DEFAULT_CONCURRENTY,
|
|
54
|
+
signal: abortController.signal,
|
|
55
|
+
collectionInfos
|
|
56
|
+
});
|
|
57
|
+
success?.(features);
|
|
58
|
+
LOG.debug("Finished loading features for extent:", extent);
|
|
59
|
+
} catch (e) {
|
|
60
|
+
if (!isAbortError(e)) {
|
|
61
|
+
LOG.error("Failed to load features", e);
|
|
62
|
+
} else {
|
|
63
|
+
LOG.debug("Query-Feature-Request aborted", e);
|
|
64
|
+
vectorSrc.removeLoadedExtent(extent);
|
|
65
|
+
failure?.();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
vectorSrc.setLoader(loaderFunction);
|
|
70
|
+
return vectorSrc;
|
|
71
|
+
}
|
|
72
|
+
function loadAllFeatures(strategy, options) {
|
|
73
|
+
switch (strategy) {
|
|
74
|
+
case "next":
|
|
75
|
+
return loadAllFeaturesNextStrategy(options);
|
|
76
|
+
case "offset":
|
|
77
|
+
return loadAllFeaturesWithOffset(options);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function loadAllFeaturesNextStrategy(options) {
|
|
81
|
+
const limit = options.limit;
|
|
82
|
+
let url = new URL(options.fullURL);
|
|
83
|
+
url.searchParams.set("limit", limit.toString());
|
|
84
|
+
let allFeatures = [];
|
|
85
|
+
do {
|
|
86
|
+
const featureResp = await loadPages(
|
|
87
|
+
[url.toString()],
|
|
88
|
+
options.featureFormat,
|
|
89
|
+
options.signal,
|
|
90
|
+
options.addFeatures,
|
|
91
|
+
options.queryFeatures
|
|
92
|
+
);
|
|
93
|
+
allFeatures = allFeatures.concat(featureResp.features);
|
|
94
|
+
if (!featureResp.nextURL) {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
url = new URL(featureResp.nextURL);
|
|
98
|
+
} while (1);
|
|
99
|
+
return allFeatures;
|
|
100
|
+
}
|
|
101
|
+
async function loadPages(allUrls, featureFormat, signal, addFeaturesFunc, queryFeaturesFunc = queryFeatures) {
|
|
102
|
+
const allFeatureResponse = {
|
|
103
|
+
nextURL: void 0,
|
|
104
|
+
numberMatched: void 0,
|
|
105
|
+
features: []
|
|
106
|
+
};
|
|
107
|
+
const allRequestPromises = allUrls.map(async (singleUrl, index) => {
|
|
108
|
+
const isLast = index === allUrls.length - 1;
|
|
109
|
+
const featureResponse = await queryFeaturesFunc(singleUrl, featureFormat, signal);
|
|
110
|
+
addFeaturesFunc(featureResponse.features);
|
|
111
|
+
LOG.debug(
|
|
112
|
+
`NextURL for index = ${index} (isLast = ${isLast}): ${featureResponse.nextURL || "No Next URL"}`
|
|
113
|
+
);
|
|
114
|
+
allFeatureResponse.features.push(...featureResponse.features);
|
|
115
|
+
if (isLast) {
|
|
116
|
+
allFeatureResponse.numberMatched = featureResponse.numberMatched;
|
|
117
|
+
allFeatureResponse.nextURL = featureResponse.nextURL;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
await Promise.all(allRequestPromises);
|
|
121
|
+
return allFeatureResponse;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export { _createVectorSource, createVectorSource, loadAllFeaturesNextStrategy, loadPages };
|
|
125
|
+
//# sourceMappingURL=OgcFeatureSourceFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OgcFeatureSourceFactory.js","sources":["OgcFeatureSourceFactory.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { createLogger, isAbortError } from \"@open-pioneer/core\";\nimport Feature, { FeatureLike } from \"ol/Feature\";\nimport { FeatureLoader } from \"ol/featureloader\";\nimport FeatureFormat from \"ol/format/Feature\";\nimport GeoJSON from \"ol/format/GeoJSON\";\nimport { Geometry } from \"ol/geom\";\nimport { bbox } from \"ol/loadingstrategy\";\nimport { AttributionLike } from \"ol/source/Source\";\nimport VectorSource, { Options } from \"ol/source/Vector\";\nimport { CollectionInfos, getCollectionInfos, loadAllFeaturesWithOffset } from \"./OffsetStrategy\";\nimport { FeatureResponse, createCollectionRequestUrl, queryFeatures } from \"./requestUtils\";\n\nconst LOG = createLogger(\"ogc-features:OgcFeatureSourceFactory\");\nconst DEFAULT_LIMIT = 5000;\nconst DEFAULT_CONCURRENTY = 6;\n\nexport interface OgcFeatureSourceOptions {\n /** The base-URL right to the \"/collections\"-part */\n baseUrl: string;\n\n /** The collection-ID */\n collectionId: string;\n\n /** the URL to the EPSG-Code, e.g. http://www.opengis.net/def/crs/EPSG/0/25832 */\n crs: string;\n\n /**\n * The maximum number of features to fetch within a single request.\n * Corresponds to the `limit` parameter in the URL.\n *\n * When the `offset` strategy is used for feature fetching, the limit\n * is used for the page size\n *\n * Default limit is 5000 for Next-Strategy and 2500 for Offset-Strategy\n */\n limit?: number;\n\n /** The maximum number of concurrent requests. Defaults to `6`. */\n maxConcurrentRequests?: number;\n\n /** Optional attribution for the layer (e.g. copyright hints). */\n attributions?: AttributionLike | undefined;\n\n /** Optional additional options for the VectorSource. */\n additionalOptions?: Options<Feature<Geometry>>;\n}\n\n/**\n * This function creates an OpenLayers VectorSource for OGC Features API services to be used inside\n * an OpenLayers VectorLayer.\n *\n * @param options Options for the vector source.\n */\nexport function createVectorSource(options: OgcFeatureSourceOptions): VectorSource {\n return _createVectorSource(options, undefined, undefined, undefined);\n}\n\n/**\n * @internal\n * Creates the actual vector source.\n * Exported for testing.\n * Exposes `queryFeatures`, `addFeatures` and `getCollectionInfos` for easier testing.\n */\nexport function _createVectorSource(\n options: OgcFeatureSourceOptions,\n queryFeaturesParam: QueryFeaturesFunc | undefined,\n addFeaturesParam: AddFeaturesFunc | undefined,\n getCollectionInfosParam: GetCollectionInfosFunc | undefined\n): VectorSource {\n const collectionItemsURL = `${options.baseUrl}/collections/${options.collectionId}/items?`;\n const vectorSrc = new VectorSource({\n format: new GeoJSON(),\n strategy: bbox,\n attributions: options.attributions,\n ...options.additionalOptions\n });\n\n const queryFeaturesFunc = queryFeaturesParam ?? queryFeatures;\n const getCollectionInfosFunc = getCollectionInfosParam ?? getCollectionInfos;\n const addFeaturesFunc =\n addFeaturesParam ||\n function (features: FeatureLike[]) {\n LOG.debug(`Adding ${features.length} features`);\n\n // Type mismatch FeatureLike <--> Feature<Geometry>\n // MIGHT be incorrect! We will see.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n vectorSrc.addFeatures(features as any);\n };\n\n // Abort controller for the currently pending request(s).\n // Used to cancel outdated requests.\n let abortController: AbortController;\n let collectionInfosPromise: Promise<CollectionInfos | undefined> | undefined;\n\n const loaderFunction: FeatureLoader = async (\n extent,\n _,\n __,\n success,\n failure\n ): Promise<void> => {\n collectionInfosPromise ??= getCollectionInfosFunc(collectionItemsURL);\n let collectionInfos;\n try {\n collectionInfos = await collectionInfosPromise;\n } catch (e) {\n LOG.error(\"Failed to retrieve collection information\", e);\n failure?.();\n collectionInfosPromise = undefined;\n return;\n }\n\n // An extent-change should cancel open requests for older extents, because otherwise,\n // old and expensive requests could block new requests for a new extent\n // => no features are drawn on the current map for a long time.\n abortController?.abort(\"Extent changed\");\n abortController = new AbortController();\n\n const fullURL = createCollectionRequestUrl(collectionItemsURL, extent, options.crs);\n const strategy = collectionInfos?.supportsOffsetStrategy ? \"offset\" : \"next\";\n try {\n const features = await loadAllFeatures(strategy, {\n fullURL: fullURL.toString(),\n featureFormat: vectorSrc.getFormat()!, // TODO\n queryFeatures: queryFeaturesFunc,\n addFeatures: addFeaturesFunc,\n limit: options.limit ?? DEFAULT_LIMIT,\n maxConcurrentRequests: options.maxConcurrentRequests ?? DEFAULT_CONCURRENTY,\n signal: abortController.signal,\n collectionInfos: collectionInfos\n });\n // Type mismatch FeatureLike <--> Feature<Geometry>\n // MIGHT be incorrect! We will see.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n success?.(features as any);\n LOG.debug(\"Finished loading features for extent:\", extent);\n } catch (e) {\n if (!isAbortError(e)) {\n LOG.error(\"Failed to load features\", e);\n } else {\n LOG.debug(\"Query-Feature-Request aborted\", e);\n vectorSrc.removeLoadedExtent(extent);\n failure?.();\n }\n }\n };\n vectorSrc.setLoader(loaderFunction);\n return vectorSrc;\n}\n\n/** @internal **/\ntype QueryFeaturesFunc = typeof queryFeatures;\n/** @internal **/\ntype GetCollectionInfosFunc = typeof getCollectionInfos;\n/** @internal **/\ntype AddFeaturesFunc = (features: FeatureLike[]) => void;\n\n/** @internal **/\nexport interface LoadFeatureOptions {\n fullURL: string;\n featureFormat: FeatureFormat;\n queryFeatures: QueryFeaturesFunc;\n addFeatures: AddFeaturesFunc;\n limit: number;\n maxConcurrentRequests: number;\n signal?: AbortSignal;\n collectionInfos?: CollectionInfos;\n}\n\n/**\n * @internal\n * Fetches _all_ features according to the given strategy.\n */\nfunction loadAllFeatures(\n strategy: \"next\" | \"offset\",\n options: LoadFeatureOptions\n): Promise<FeatureLike[]> {\n switch (strategy) {\n case \"next\":\n return loadAllFeaturesNextStrategy(options);\n case \"offset\":\n return loadAllFeaturesWithOffset(options);\n }\n}\n\n/**\n * @internal\n * Fetches features by following the `next` links in the server's response.\n */\nexport async function loadAllFeaturesNextStrategy(\n options: Omit<LoadFeatureOptions, \"offsetRequestProps\" | \"collectionInfos\">\n): Promise<FeatureLike[]> {\n const limit = options.limit;\n\n let url = new URL(options.fullURL);\n url.searchParams.set(\"limit\", limit.toString());\n let allFeatures: FeatureLike[] = [];\n do {\n const featureResp = await loadPages(\n [url.toString()],\n options.featureFormat,\n options.signal,\n options.addFeatures,\n options.queryFeatures\n );\n\n allFeatures = allFeatures.concat(featureResp.features);\n if (!featureResp.nextURL) {\n break;\n }\n\n url = new URL(featureResp.nextURL);\n // eslint-disable-next-line no-constant-condition\n } while (1);\n return allFeatures;\n}\n\nexport async function loadFeatures(\n requestUrl: string,\n featureFormat: FeatureFormat,\n signal: AbortSignal | undefined,\n addFeaturesFunc: AddFeaturesFunc,\n queryFeaturesFunc: QueryFeaturesFunc = queryFeatures\n): Promise<FeatureResponse> {\n const featureResponse = await queryFeaturesFunc(requestUrl, featureFormat, signal);\n const features = featureResponse.features as FeatureLike[];\n addFeaturesFunc(features);\n return featureResponse;\n}\n\n/**\n * Loads features from multiple urls in parallel.\n * The URLs should represent pages of the same result set.\n * The `nextURL` of the last page (if any) is returned from this function.\n *\n * @internal\n */\nexport async function loadPages(\n allUrls: Array<string>,\n featureFormat: FeatureFormat,\n signal: AbortSignal | undefined,\n addFeaturesFunc: AddFeaturesFunc,\n queryFeaturesFunc: QueryFeaturesFunc = queryFeatures\n): Promise<FeatureResponse> {\n const allFeatureResponse: FeatureResponse = {\n nextURL: undefined,\n numberMatched: undefined,\n features: []\n };\n const allRequestPromises = allUrls.map(async (singleUrl, index): Promise<void> => {\n const isLast = index === allUrls.length - 1;\n\n const featureResponse = await queryFeaturesFunc(singleUrl, featureFormat, signal);\n addFeaturesFunc(featureResponse.features as FeatureLike[]);\n\n LOG.debug(\n `NextURL for index = ${index} (isLast = ${isLast}): ${\n featureResponse.nextURL || \"No Next URL\"\n }`\n );\n allFeatureResponse.features.push(...featureResponse.features);\n if (isLast) {\n allFeatureResponse.numberMatched = featureResponse.numberMatched;\n allFeatureResponse.nextURL = featureResponse.nextURL;\n }\n });\n await Promise.all(allRequestPromises);\n return allFeatureResponse;\n}\n"],"names":[],"mappings":";;;;;;;AAcA,MAAM,GAAA,GAAM,aAAa,sCAAsC,CAAA,CAAA;AAC/D,MAAM,aAAgB,GAAA,GAAA,CAAA;AACtB,MAAM,mBAAsB,GAAA,CAAA,CAAA;AAuCrB,SAAS,mBAAmB,OAAgD,EAAA;AAC/E,EAAA,OAAO,mBAAoB,CAAA,OAAA,EAAS,KAAW,CAAA,EAAA,KAAA,CAAA,EAAW,KAAS,CAAA,CAAA,CAAA;AACvE,CAAA;AAQO,SAAS,mBACZ,CAAA,OAAA,EACA,kBACA,EAAA,gBAAA,EACA,uBACY,EAAA;AACZ,EAAA,MAAM,qBAAqB,CAAG,EAAA,OAAA,CAAQ,OAAO,CAAA,aAAA,EAAgB,QAAQ,YAAY,CAAA,OAAA,CAAA,CAAA;AACjF,EAAM,MAAA,SAAA,GAAY,IAAI,YAAa,CAAA;AAAA,IAC/B,MAAA,EAAQ,IAAI,OAAQ,EAAA;AAAA,IACpB,QAAU,EAAA,IAAA;AAAA,IACV,cAAc,OAAQ,CAAA,YAAA;AAAA,IACtB,GAAG,OAAQ,CAAA,iBAAA;AAAA,GACd,CAAA,CAAA;AAED,EAAA,MAAM,oBAAoB,kBAAsB,IAAA,aAAA,CAAA;AAChD,EAAA,MAAM,yBAAyB,uBAA2B,IAAA,kBAAA,CAAA;AAC1D,EAAM,MAAA,eAAA,GACF,gBACA,IAAA,SAAU,QAAyB,EAAA;AAC/B,IAAA,GAAA,CAAI,KAAM,CAAA,CAAA,OAAA,EAAU,QAAS,CAAA,MAAM,CAAW,SAAA,CAAA,CAAA,CAAA;AAK9C,IAAA,SAAA,CAA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AmB,UAAU,eAAgB,CAAA,OAAA,CAAA;AAAA,KACjD;AAAA,GACH,CAAA,CAAA;AACD,EAAM,MAAA,OAAA,CAAQ,IAAI,kBAAkB,CAAA,CAAA;AACpC,EAAO,OAAA,kBAAA,CAAA;AACX;;;;"}
|
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# @open-pioneer/ogc-features
|
|
2
|
+
|
|
3
|
+
This package provides a function to create an OpenLayers VectorSource to be used with OGC API Features service.
|
|
4
|
+
This VectorSource should be used inside together with a VectorLayer.
|
|
5
|
+
|
|
6
|
+
## Usage
|
|
7
|
+
|
|
8
|
+
Just import the function with:
|
|
9
|
+
|
|
10
|
+
```js
|
|
11
|
+
import { createVectorSource } from "@open-pioneer/ogc-features";
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
and use it inside a VectorLayer:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
layer: new VectorLayer({
|
|
18
|
+
source: createVectorSource({
|
|
19
|
+
baseUrl: "https://ogc-api.nrw.de/inspire-us-kindergarten/v1",
|
|
20
|
+
collectionId: "governmentalservice",
|
|
21
|
+
crs: "http://www.opengis.net/def/crs/EPSG/0/25832",
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The maximum number of features to fetch within a single request.
|
|
25
|
+
* Corresponds to the `limit` parameter in the URL.
|
|
26
|
+
*
|
|
27
|
+
* When the `offset` strategy is used for feature fetching, the limit
|
|
28
|
+
* is used for the page size.
|
|
29
|
+
*
|
|
30
|
+
* Default limit is 5000
|
|
31
|
+
*/
|
|
32
|
+
limit: 5000,
|
|
33
|
+
|
|
34
|
+
/** The maximum number of concurrent requests. Defaults to `6`. */
|
|
35
|
+
maxConcurrentRequests: 6,
|
|
36
|
+
|
|
37
|
+
attributions:
|
|
38
|
+
"<a href='https://www.govdata.de/dl-de/by-2-0'>Datenlizenz Deutschland - Namensnennung - Version 2.0</a>",
|
|
39
|
+
|
|
40
|
+
additionalOptions: {} // (Optional)
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
The optional `limit` configures the concurrent execution of requests by using the `offset` URL property for pagination.
|
|
46
|
+
If the service returns a `numberMatched` property together with its results, it is used alongside the configured pageSize to calculate the optimal number of concurrent requests.
|
|
47
|
+
The number of concurrent requests is never higher than `maxConcurrentRequests`.
|
|
48
|
+
|
|
49
|
+
Additional options of the `VectorSource` (see [OpenLayers documentation](https://openlayers.org/en/latest/apidoc/module-ol_source_Vector-VectorSource.html)) can be given by the property
|
|
50
|
+
`additionalOptions`.
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
Apache-2.0 (see `LICENSE` file)
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createVectorSource, type OgcFeatureSourceOptions } from "./OgcFeatureSourceFactory";
|
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "module",
|
|
3
|
+
"name": "@open-pioneer/ogc-features",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"@open-pioneer/core": "^1.1.0",
|
|
8
|
+
"ol": "^8.2.0"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
"./package.json": "./package.json",
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./index.js",
|
|
14
|
+
"types": "./index.d.ts"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"openPioneerFramework": {
|
|
18
|
+
"services": [],
|
|
19
|
+
"i18n": {
|
|
20
|
+
"languages": []
|
|
21
|
+
},
|
|
22
|
+
"ui": {
|
|
23
|
+
"references": []
|
|
24
|
+
},
|
|
25
|
+
"properties": [],
|
|
26
|
+
"packageFormatVersion": "1.0.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Extent } from "ol/extent";
|
|
2
|
+
import FeatureFormat from "ol/format/Feature";
|
|
3
|
+
import { FeatureLike } from "ol/Feature";
|
|
4
|
+
/**
|
|
5
|
+
* Assembles the url to use for fetching features in the given extent.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createCollectionRequestUrl(collectionItemsURL: string, extent: Extent, crs: string): URL;
|
|
8
|
+
/**
|
|
9
|
+
* Adds (or replaces) offset/limit params on the given url.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createOffsetURL(fullURL: string, offset: number, pageSize: number): string;
|
|
12
|
+
/**
|
|
13
|
+
* Extracts the `next` link from the service response's `links` property.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getNextURL(rawLinks: unknown): string | undefined;
|
|
16
|
+
export interface FeatureResponse {
|
|
17
|
+
features: FeatureLike[];
|
|
18
|
+
nextURL: string | undefined;
|
|
19
|
+
numberMatched: number | undefined;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @internal
|
|
23
|
+
* Performs a single request against the service
|
|
24
|
+
*/
|
|
25
|
+
export declare function queryFeatures(fullURL: string, featureFormat: FeatureFormat | undefined, signal: AbortSignal | undefined): Promise<FeatureResponse>;
|
package/requestUtils.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const NEXT_LINK_PROP = "next";
|
|
2
|
+
function createCollectionRequestUrl(collectionItemsURL, extent, crs) {
|
|
3
|
+
const urlObj = new URL(collectionItemsURL);
|
|
4
|
+
const searchParams = urlObj.searchParams;
|
|
5
|
+
searchParams.set("bbox", extent.join(","));
|
|
6
|
+
searchParams.set("bbox-crs", crs);
|
|
7
|
+
searchParams.set("crs", crs);
|
|
8
|
+
searchParams.set("f", "json");
|
|
9
|
+
return urlObj;
|
|
10
|
+
}
|
|
11
|
+
function createOffsetURL(fullURL, offset, pageSize) {
|
|
12
|
+
const url = new URL(fullURL);
|
|
13
|
+
const searchParams = url.searchParams;
|
|
14
|
+
searchParams.set("offset", offset.toString());
|
|
15
|
+
searchParams.set("limit", pageSize.toString());
|
|
16
|
+
return url.toString();
|
|
17
|
+
}
|
|
18
|
+
function getNextURL(rawLinks) {
|
|
19
|
+
if (!Array.isArray(rawLinks)) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
const links = rawLinks;
|
|
23
|
+
const nextLinks = links.filter((link) => link.rel === NEXT_LINK_PROP);
|
|
24
|
+
if (nextLinks.length !== 1)
|
|
25
|
+
return;
|
|
26
|
+
return nextLinks[0]?.href;
|
|
27
|
+
}
|
|
28
|
+
async function queryFeatures(fullURL, featureFormat, signal) {
|
|
29
|
+
let features = [];
|
|
30
|
+
const requestInit = {
|
|
31
|
+
headers: {
|
|
32
|
+
Accept: "application/geo+json"
|
|
33
|
+
},
|
|
34
|
+
signal
|
|
35
|
+
};
|
|
36
|
+
const response = await fetch(fullURL, requestInit);
|
|
37
|
+
if (response.status !== 200) {
|
|
38
|
+
throw new Error(`Failed to query features from service (status code ${response.status})`);
|
|
39
|
+
}
|
|
40
|
+
const geoJson = await response.json();
|
|
41
|
+
if (featureFormat) {
|
|
42
|
+
features = featureFormat.readFeatures(geoJson);
|
|
43
|
+
}
|
|
44
|
+
const nextURL = getNextURL(geoJson.links);
|
|
45
|
+
return {
|
|
46
|
+
features,
|
|
47
|
+
numberMatched: geoJson.numberMatched,
|
|
48
|
+
nextURL
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { createCollectionRequestUrl, createOffsetURL, getNextURL, queryFeatures };
|
|
53
|
+
//# sourceMappingURL=requestUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestUtils.js","sources":["requestUtils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2023 Open Pioneer project (https://github.com/open-pioneer)\n// SPDX-License-Identifier: Apache-2.0\nimport { Extent } from \"ol/extent\";\nimport FeatureFormat from \"ol/format/Feature\";\nimport { FeatureLike } from \"ol/Feature\";\n\nconst NEXT_LINK_PROP = \"next\";\n\n/**\n * Assembles the url to use for fetching features in the given extent.\n */\nexport function createCollectionRequestUrl(\n collectionItemsURL: string,\n extent: Extent,\n crs: string\n): URL {\n const urlObj = new URL(collectionItemsURL);\n const searchParams = urlObj.searchParams;\n searchParams.set(\"bbox\", extent.join(\",\"));\n searchParams.set(\"bbox-crs\", crs);\n searchParams.set(\"crs\", crs);\n searchParams.set(\"f\", \"json\");\n return urlObj;\n}\n\n/**\n * Adds (or replaces) offset/limit params on the given url.\n */\nexport function createOffsetURL(fullURL: string, offset: number, pageSize: number): string {\n const url = new URL(fullURL);\n const searchParams = url.searchParams;\n searchParams.set(\"offset\", offset.toString());\n searchParams.set(\"limit\", pageSize.toString());\n return url.toString();\n}\n\n/**\n * Extracts the `next` link from the service response's `links` property.\n */\nexport function getNextURL(rawLinks: unknown): string | undefined {\n if (!Array.isArray(rawLinks)) {\n return undefined;\n }\n\n interface ObjWithRelAndHref {\n href: string;\n rel: string;\n }\n\n // We just assume the correct object shape\n const links = rawLinks as ObjWithRelAndHref[];\n\n const nextLinks = links.filter((link) => link.rel === NEXT_LINK_PROP);\n if (nextLinks.length !== 1) return;\n return nextLinks[0]?.href;\n}\n\nexport interface FeatureResponse {\n features: FeatureLike[];\n nextURL: string | undefined;\n numberMatched: number | undefined;\n}\n\n/**\n * @internal\n * Performs a single request against the service\n */\nexport async function queryFeatures(\n fullURL: string,\n featureFormat: FeatureFormat | undefined,\n signal: AbortSignal | undefined\n): Promise<FeatureResponse> {\n let features: FeatureLike[] = [];\n const requestInit: RequestInit = {\n headers: {\n Accept: \"application/geo+json\"\n },\n signal\n };\n const response = await fetch(fullURL, requestInit);\n if (response.status !== 200) {\n throw new Error(`Failed to query features from service (status code ${response.status})`);\n }\n const geoJson = await response.json();\n if (featureFormat) {\n features = featureFormat.readFeatures(geoJson);\n }\n const nextURL = getNextURL(geoJson.links);\n return {\n features: features,\n numberMatched: geoJson.numberMatched,\n nextURL: nextURL\n };\n}\n"],"names":[],"mappings":"AAMA,MAAM,cAAiB,GAAA,MAAA,CAAA;AAKP,SAAA,0BAAA,CACZ,kBACA,EAAA,MAAA,EACA,GACG,EAAA;AACH,EAAM,MAAA,MAAA,GAAS,IAAI,GAAA,CAAI,kBAAkB,CAAA,CAAA;AACzC,EAAA,MAAM,eAAe,MAAO,CAAA,YAAA,CAAA;AAC5B,EAAA,YAAA,CAAa,GAAI,CAAA,MAAA,EAAQ,MAAO,CAAA,IAAA,CAAK,GAAG,CAAC,CAAA,CAAA;AACzC,EAAa,YAAA,CAAA,GAAA,CAAI,YAAY,GAAG,CAAA,CAAA;AAChC,EAAa,YAAA,CAAA,GAAA,CAAI,OAAO,GAAG,CAAA,CAAA;AAC3B,EAAa,YAAA,CAAA,GAAA,CAAI,KAAK,MAAM,CAAA,CAAA;AAC5B,EAAO,OAAA,MAAA,CAAA;AACX,CAAA;AAKgB,SAAA,eAAA,CAAgB,OAAiB,EAAA,MAAA,EAAgB,QAA0B,EAAA;AACvF,EAAM,MAAA,GAAA,GAAM,IAAI,GAAA,CAAI,OAAO,CAAA,CAAA;AAC3B,EAAA,MAAM,eAAe,GAAI,CAAA,YAAA,CAAA;AACzB,EAAA,YAAA,CAAa,GAAI,CAAA,QAAA,EAAU,MAAO,CAAA,QAAA,EAAU,CAAA,CAAA;AAC5C,EAAA,YAAA,CAAa,GAAI,CAAA,OAAA,EAAS,QAAS,CAAA,QAAA,EAAU,CAAA,CAAA;AAC7C,EAAA,OAAO,IAAI,QAAS,EAAA,CAAA;AACxB,CAAA;AAKO,SAAS,WAAW,QAAuC,EAAA;AAC9D,EAAA,IAAI,CAAC,KAAA,CAAM,OAAQ,CAAA,QAAQ,CAAG,EAAA;AAC1B,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACX;AAQA,EAAA,MAAM,KAAQ,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