Skip to content

Commit cc8717b

Browse files
author
Phil Varner
authored
Merge pull request #444 from stac-utils/pv/fix-collection-aggregation
collection-level aggregation how has the collection id properly applied
2 parents 7c4b6a2 + 11daaf5 commit cc8717b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/lib/api.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -639,15 +639,6 @@ const aggregate = async function (collectionId,
639639
const ids = extractIds(queryParameters)
640640
const collections = extractCollectionIds(queryParameters)
641641

642-
let linkEndpoint = endpoint
643-
let collectionEndpoint
644-
645-
if (collectionId) {
646-
queryParameters.collections = [collectionId]
647-
linkEndpoint = `${endpoint}/collections/${collectionId}`
648-
collectionEndpoint = `${endpoint}/collections/${collectionId}`
649-
}
650-
651642
const searchParams = pickBy({
652643
datetime,
653644
intersects: geometry,
@@ -656,6 +647,15 @@ const aggregate = async function (collectionId,
656647
collections,
657648
})
658649

650+
let linkEndpoint = endpoint
651+
let collectionEndpoint
652+
653+
if (collectionId) {
654+
searchParams.collections = [collectionId]
655+
linkEndpoint = `${endpoint}/collections/${collectionId}`
656+
collectionEndpoint = `${endpoint}/collections/${collectionId}`
657+
}
658+
659659
logger.debug('Aggregate parameters: %j', searchParams)
660660

661661
let esResponse

0 commit comments

Comments
 (0)