Skip to content
Snippets Groups Projects
Commit e042fd04 authored by BrittainJackson7's avatar BrittainJackson7
Browse files

Update offset to be scaleable

parent 5e26bf4c
Branches
No related tags found
No related merge requests found
...@@ -64,65 +64,11 @@ export async function FetchFootprints(collection, page, step){ ...@@ -64,65 +64,11 @@ export async function FetchFootprints(collection, page, step){
// check for pyGeo API // check for pyGeo API
if (!collection.url.includes('stac')) if (!collection.url.includes('stac'))
{ {
// set offset for 5 & 10 steps
offsetMulitiplier = (page * 10 - step);
pageInfo = "&offset=" + offsetMulitiplier;
// checks for 5 change in step
if (step <= 10)
{
// splice limit and change to new limit
collectionUrl = collection.url.split('&limit=')[0];
collection.url = collectionUrl;
// update page pageInfo
pageInfo = "&offset=" + offsetMulitiplier + "&limit=" + step;
}
// checks for 50 & 100 step
else if (step == 50 || step == 100)
{
// splice limit and change to new limit
collectionUrl = collection.url.split('&limit=')[0]; collectionUrl = collection.url.split('&limit=')[0];
collection.url = collectionUrl;
// check for first page offsetMulitiplier = (page - 1) * step;
if (page == 1)
{
// set multiplier to 0
offsetMulitiplier = 0;
}
// check for second page
else if (page == 2)
{
// set multiplier to step
offsetMulitiplier = step;
}
else
{
// check for 50 and set pages according
if (step == 50)
{
offsetMulitiplier = page * step - 50;
}
// check for 100 and set pages according
else
{
offsetMulitiplier = page * step - 100;
}
}
// update page pageInfo
pageInfo = "&offset=" + offsetMulitiplier + "&limit=" + step;
}
collection.url = `${collectionUrl}&offset=${offsetMulitiplier}&limit=${step}`;
} }
// reset offset // reset offset
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment