Loading src/components/presentational/FootprintResults.jsx +2 −2 Original line number Original line Diff line number Diff line Loading @@ -75,7 +75,7 @@ export default function FootprintResults(props) { let newPage = numFeatures/step + 1; let newPage = numFeatures/step + 1; let newFeatures = await FetchFootprints(featureCollections[collectionId], newPage, step); let newFeatures = await FetchFootprints(featureCollections[collectionId], newPage, step); // If any features are returned, add them to currecnt collection // If any features are returned, add them to current collection if (newFeatures.length > 0) { if (newFeatures.length > 0) { addFeatures(newFeatures, collectionId); addFeatures(newFeatures, collectionId); } } Loading Loading @@ -126,7 +126,7 @@ export default function FootprintResults(props) { myFilter = "&limit=" + step; myFilter = "&limit=" + step; } } if(isInStacAPI) { if(isInStacAPI || isInPyAPI) { let itemsUrl = collection.links.find(link => link.rel === "items").href; let itemsUrl = collection.links.find(link => link.rel === "items").href; collectionUrls[collection.id] = itemsUrl + myFilter + pageInfo; collectionUrls[collection.id] = itemsUrl + myFilter + pageInfo; } } Loading src/js/FootprintFetcher.js +60 −2 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ export async function FetchObjects(objInfo) { * @param {string} queryString - The query to narrow the results returned from the collection. * @param {string} queryString - The query to narrow the results returned from the collection. */ */ export async function FetchFootprints(collection, page, step){ export async function FetchFootprints(collection, page, step){ let collectionUrl; let offsetMulitiplier; let offsetMulitiplier; let pageInfo = ""; let pageInfo = ""; if(collection.url.slice(-1) !== "?") { if(collection.url.slice(-1) !== "?") { Loading @@ -63,12 +64,69 @@ 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')) { { offsetMulitiplier = (page * 10 - 10); // set offset for 5 & 10 steps offsetMulitiplier = (page * 10 - step); pageInfo = "&offset=" + offsetMulitiplier; 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; 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 offsetMulitiplier = 0; let jsonRes = await FetchObjects(collection.url + pageInfo); let jsonRes = await FetchObjects(collection.url + pageInfo); return jsonRes.features; return jsonRes.features; Loading src/js/AstroMap.js +1 −1 File changed.Contains only whitespace changes. Show changes Loading
src/components/presentational/FootprintResults.jsx +2 −2 Original line number Original line Diff line number Diff line Loading @@ -75,7 +75,7 @@ export default function FootprintResults(props) { let newPage = numFeatures/step + 1; let newPage = numFeatures/step + 1; let newFeatures = await FetchFootprints(featureCollections[collectionId], newPage, step); let newFeatures = await FetchFootprints(featureCollections[collectionId], newPage, step); // If any features are returned, add them to currecnt collection // If any features are returned, add them to current collection if (newFeatures.length > 0) { if (newFeatures.length > 0) { addFeatures(newFeatures, collectionId); addFeatures(newFeatures, collectionId); } } Loading Loading @@ -126,7 +126,7 @@ export default function FootprintResults(props) { myFilter = "&limit=" + step; myFilter = "&limit=" + step; } } if(isInStacAPI) { if(isInStacAPI || isInPyAPI) { let itemsUrl = collection.links.find(link => link.rel === "items").href; let itemsUrl = collection.links.find(link => link.rel === "items").href; collectionUrls[collection.id] = itemsUrl + myFilter + pageInfo; collectionUrls[collection.id] = itemsUrl + myFilter + pageInfo; } } Loading
src/js/FootprintFetcher.js +60 −2 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ export async function FetchObjects(objInfo) { * @param {string} queryString - The query to narrow the results returned from the collection. * @param {string} queryString - The query to narrow the results returned from the collection. */ */ export async function FetchFootprints(collection, page, step){ export async function FetchFootprints(collection, page, step){ let collectionUrl; let offsetMulitiplier; let offsetMulitiplier; let pageInfo = ""; let pageInfo = ""; if(collection.url.slice(-1) !== "?") { if(collection.url.slice(-1) !== "?") { Loading @@ -63,12 +64,69 @@ 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')) { { offsetMulitiplier = (page * 10 - 10); // set offset for 5 & 10 steps offsetMulitiplier = (page * 10 - step); pageInfo = "&offset=" + offsetMulitiplier; 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; 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 offsetMulitiplier = 0; let jsonRes = await FetchObjects(collection.url + pageInfo); let jsonRes = await FetchObjects(collection.url + pageInfo); return jsonRes.features; return jsonRes.features; Loading