Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove landsat gridcode special handling #284

Merged
merged 4 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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