Skip to content

Commit

Permalink
Merge pull request #284 from Element84/ba/remove-landsat-gridcode-spe…
Browse files Browse the repository at this point in the history
…cial-handling

remove landsat gridcode special handling
  • Loading branch information
Phil Varner authored Dec 1, 2023
2 parents 19debe7 + 3999e47 commit 2bb6fa8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 36 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Update link tag for manifest.json so that it uses basic auth credentials, fixes load when running behind CloudFront with basic auth

### Removed

- Special handling of `grid_code_landsat_frequency` aggregation

## 4.3.0 - 2023-10-13

### Fixed
Expand Down
11 changes: 7 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 5 additions & 32 deletions src/utils/searchHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ export function newSearch() {
const includesGridCode = _selectedCollection.aggregations?.some(
(el) => el.name === 'grid_code_frequency'
)
const includesGridCodeLandsat = _selectedCollection.aggregations?.some(
(el) => el.name === 'grid_code_landsat_frequency'
)

if (store.getState().mainSlice.viewMode !== 'scene') {
if (currentMapZoomLevel < 7) {
Expand All @@ -80,7 +77,7 @@ export function newSearch() {
AggregateSearchService(searchAggregateParams, 'hex')
return
}
if (includesGridCode || includesGridCodeLandsat) {
if (includesGridCode) {
if (currentMapZoomLevel < midZoomLevel) {
store.dispatch(setZoomLevelNeeded(midZoomLevel))
store.dispatch(setShowZoomNotice(true))
Expand Down Expand Up @@ -135,17 +132,7 @@ function buildSearchScenesParams(gridCodeToSearchIn) {
query['sar:polarizations'] = { in: ['VV', 'VH'] }
}
if (gridCodeToSearchIn) {
if (
_selectedCollection.aggregations.some(
(item) => item.name === 'grid_code_landsat_frequency'
)
) {
// extract the path and row from gridcode value, e.g., WRS2-123123
query['landsat:wrs_path'] = { eq: gridCodeToSearchIn.substring(5, 8) }
query['landsat:wrs_row'] = { eq: gridCodeToSearchIn.slice(-3) }
} else {
query['grid:code'] = { eq: gridCodeToSearchIn }
}
query['grid:code'] = { eq: gridCodeToSearchIn }
}

let searchParamsStr
Expand Down Expand Up @@ -203,12 +190,7 @@ function buildSearchAggregateParams(gridType) {
}
aggregations = `grid_geohex_frequency,total_count&grid_geohex_frequency_precision=${precision}`
} else {
const gridAggName = _selectedCollection.aggregations.some(
(item) => item.name === 'grid_code_frequency'
)
? 'grid_code_frequency'
: 'grid_code_landsat_frequency'
aggregations = `${gridAggName},total_count`
aggregations = `grid_code_frequency,total_count`
}

const searchParams = new Map([
Expand Down Expand Up @@ -348,24 +330,15 @@ function fixAntiMeridianPoints(hexBoundary) {
}

export function mapGridCodeFromJson(json) {
const _selectedCollection = store.getState().mainSlice.selectedCollectionData
const _gridCellData = store.getState().mainSlice.localGridData
const gridAggName = _selectedCollection.aggregations.some(
(item) => item.name === 'grid_code_frequency'
)
? 'grid_code_frequency'
: 'grid_code_landsat_frequency'
const buckets = json.aggregations?.find(
(el) => el.name === gridAggName
(el) => el.name === 'grid_code_frequency'
).buckets

const numberMatched = json?.aggregations?.find(
(el) => el.name === 'total_count'
)?.value
const overflow = json?.aggregations.find(
(el) =>
el.name === 'grid_code_frequency' ||
el.name === 'grid_code_landsat_frequency'
(el) => el.name === 'grid_code_frequency'
).overflow

// create Geojson file with matched geometry and frequency
Expand Down

0 comments on commit 2bb6fa8

Please sign in to comment.