Commit 8792133
authored
feat(add-data): add OGC API - Features collections as vector layers (#1449)
* feat(add-data): add OGC API - Features collections as vector layers
GeoLibre could reach OGC feature services only through WFS, so a modern
OGC API - Features endpoint (the WFS successor: no capabilities document,
JSON-native, paged) had no way in.
Add an "OGC API - Features" source to the Add Data menu:
- `lib/ogc-api-features.ts` owns the client. `parseOgcFeaturesUrl` accepts
whatever URL the user has in hand -- a landing page, `/collections`, a
collection, or the full `/collections/{id}/items` URL a service's own HTML
browser puts in the address bar -- and splits it into a base URL plus
collection id, keeping non-OGC query params (an API key) and dropping the
request params the builder sets itself, so a pasted `f=html&limit=10`
cannot fight the request built on top of it.
- The items fetch follows the service's `next` links until the requested
feature count is reached. This is the part a single request gets wrong:
pygeoapi's demo caps `limit` at 10, so a naive fetch yields 10 of 25
features. Paging stops on an empty page (many services advertise `next`
even on the last one), refuses a `next` that leaves the service's origin,
and shares one deadline across every page.
- `OgcFeaturesSource` retrieves the collection list, preselects the one a
pasted URL named, and offers optional bbox and datetime filters.
- The layer persists its request, so `Refresh` replays the same paged walk
instead of silently shrinking to the stored first page.
The JSON fetch that works around missing CORS headers (Tauri native HTTP /
dev proxy / direct) moves to `lib/ogc-json.ts` and is now shared with the
OGC API - Tiles client, which had the only copy; it also surfaces a service's
JSON problem-document description alongside the status on a failed request.
Fixes #1446
* Address CodeRabbit review feedback
- Propagate the refreshed paging metadata for OGC API - Features layers.
`refreshGeoJsonLayer` now returns an optional `metadata` patch, and the
OGC branch fills it with the `numberMatched`/`truncated` from the fetch it
just ran; LayerPanel merges it alongside `featureCount`, so a refreshed
layer no longer reports the counts it was originally added with. The
legacy single-page fallback deliberately sends no patch: it has no
`numberMatched` to compare against, so leaving the stored values alone
beats overwriting them with a guess.
- Spell the default layer name "OGC API - Features Layer", matching the
hyphenated official name every other new string already uses.1 parent 2b70fec commit 8792133
14 files changed
Lines changed: 1470 additions & 74 deletions
File tree
- apps/geolibre-desktop/src
- components
- layout
- add-data
- sources
- toolbar
- panels
- i18n/locales
- lib
- tests
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
295 | 296 | | |
296 | 297 | | |
297 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
298 | 356 | | |
299 | 357 | | |
300 | 358 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
90 | 97 | | |
91 | 98 | | |
92 | 99 | | |
| |||
0 commit comments