diff --git a/src/js/FootprintFetcher.js b/src/js/FootprintFetcher.js index 045af2d4368b389e0b59d9cdbf814778eeb7bac3..47acf86452f5d22023c698ef74af91b30a9bb442 100644 --- a/src/js/FootprintFetcher.js +++ b/src/js/FootprintFetcher.js @@ -64,11 +64,66 @@ export async function FetchFootprints(collection, page, step){ // check for pyGeo API if (!collection.url.includes('stac')) { - collectionUrl = collection.url.split('&limit=')[0]; - offsetMulitiplier = (page - 1) * step; - - collection.url = `${collectionUrl}&offset=${offsetMulitiplier}&limit=${step}`; + // 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]; + collection.url = collectionUrl; + + // check for first page + 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; + } + + } // reset offset