Skip to content

Commit 3e5883f

Browse files
committed
Support visualizing collections as children
1 parent 18ef198 commit 3e5883f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/ol/layer/STAC.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import * as pmtiles from 'pmtiles';
2424
import create, {
2525
APICollection,
2626
Asset,
27+
CollectionCollection,
2728
Item,
2829
ItemCollection,
2930
STAC,
@@ -72,7 +73,7 @@ import {
7273
* `setAbsoluteUrl` on the stac-js object before passing it in.
7374
* @property {STAC|Asset|Object} [data] The STAC metadata. Any of `url` and `data` must be provided.
7475
* `data` take precedence over `url`.
75-
* @property {ItemCollection|Object|Array<STAC|Object>|null} [children=null] For STAC Catalogs and Collections, any child entites
76+
* @property {APICollection|Object|Array<STAC|Object>|null} [children=null] For STAC Catalogs and Collections, any child entites
7677
* to show. Can be STAC ItemCollections (as ItemCollection or GeoJSON FeatureCollection) or a list of STAC entities.
7778
* @property {Options} [childrenOptions={}] The the given children, apply the given options.
7879
* @property {Array<string|Asset>|null} [assets=null] The selector for the assets to be rendered,
@@ -382,7 +383,7 @@ class STACLayer extends LayerGroup {
382383
/**
383384
* @param {STAC|Asset|Object} data The STAC data.
384385
* @param {string} url The url to the data.
385-
* @param {ItemCollection|Object|Array<STAC>|string|null} children The child STAC entities to show.
386+
* @param {APICollection|Object|Array<STAC>|string|null} children The child STAC entities to show.
386387
* @param {Array<Asset|string>|null} assets The assets to show.
387388
* @param {Array<number>} bands The (one-based) bands to show.
388389
* @private
@@ -1136,7 +1137,7 @@ class STACLayer extends LayerGroup {
11361137
*
11371138
* If an object is passed, it must be a GeoJSON FeatureCollection.
11381139
*
1139-
* @param {ItemCollection|Object|Array<STAC|Object>|null} childs The children to show.
1140+
* @param {APICollection|Object|Array<STAC|Object>|null} childs The children to show.
11401141
* @param {Options|null} [options] Optionally, new STACLayer options for the children. Only applies if `children` are given.
11411142
* @param {boolean} [updateLayers] Whether to update the layers right away.
11421143
* @return {Promise} Resolves when all items are rendered.
@@ -1145,6 +1146,8 @@ class STACLayer extends LayerGroup {
11451146
async setChildren(childs, options = null, updateLayers = true) {
11461147
if (childs instanceof ItemCollection) {
11471148
this.children_ = childs.getAll();
1149+
} else if (childs instanceof CollectionCollection) {
1150+
this.children_ = childs.getAll();
11481151
} else if (isObject(childs) && childs.type === 'FeatureCollection') {
11491152
this.children_ = create(childs, !this.disableMigration_).getAll();
11501153
} else if (Array.isArray(childs)) {

0 commit comments

Comments
 (0)