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

WV-3220 Smaller Extent BBox For Finding High-Resolution Imagery #5347

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Changes from 1 commit
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
22 changes: 20 additions & 2 deletions web/js/components/layer/settings/imagery-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,17 @@ export default function ImagerySearch({ layer }) {
}
return maxExtent[i];
});
const xDiff = Math.abs(extent[0] - extent[2]);
christof-wittreich marked this conversation as resolved.
Show resolved Hide resolved
const yDiff = Math.abs(extent[1] - extent[3]);
// Reduce width by 40% and height by 20%, to show only centered data
const smallerExtent = [
extent[0] + (xDiff * 0.2),
extent[1] + (yDiff * 0.1),
extent[2] - (xDiff * 0.2),
extent[3] - (yDiff * 0.1),
];
try {
const olderUrl = `https://cmr.earthdata.nasa.gov/search/granules.json?collection_concept_id=${conceptID}&bounding_box=${extent.join(',')}&temporal=,${refDate.toISOString()}&sort_key=-start_date&pageSize=25&page_num=${pageNum}`;
const olderUrl = `https://cmr.earthdata.nasa.gov/search/granules.json?collection_concept_id=${conceptID}&bounding_box=${smallerExtent.join(',')}&temporal=,${refDate.toISOString()}&sort_key=-start_date&pageSize=25&page_num=${pageNum}`;
const olderResponse = await fetch(olderUrl, { headers });
const olderGranules = await olderResponse.json();
const olderDates = olderGranules.feed.entry.map(parseGranuleTimestamp);
Expand All @@ -67,8 +76,17 @@ export default function ImagerySearch({ layer }) {
}
return maxExtent[i];
});
const xDiff = Math.abs(extent[0] - extent[2]);
const yDiff = Math.abs(extent[1] - extent[3]);
// Reduce width by 40% and height by 20%, to show only centered data
const smallerExtent = [
extent[0] + (xDiff * 0.2),
extent[1] + (yDiff * 0.1),
extent[2] - (xDiff * 0.2),
extent[3] - (yDiff * 0.1),
];
try {
const newerUrl = `https://cmr.earthdata.nasa.gov/search/granules.json?collection_concept_id=${conceptID}&bounding_box=${extent.join(',')}&temporal=${refDate.toISOString()},&sort_key=start_date&pageSize=25&page_num=${pageNum}`;
const newerUrl = `https://cmr.earthdata.nasa.gov/search/granules.json?collection_concept_id=${conceptID}&bounding_box=${smallerExtent.join(',')}&temporal=${refDate.toISOString()},&sort_key=start_date&pageSize=25&page_num=${pageNum}`;
const newerResponse = await fetch(newerUrl, { headers });
const newerGranules = await newerResponse.json();
const newerDates = newerGranules.feed.entry.map(parseGranuleTimestamp);
Expand Down
Loading