Loading app/src/js/ApiJsonCollection.js +18 −18 Original line number Diff line number Diff line Loading @@ -71,23 +71,23 @@ function getItemCollection(name) { } } function getStacItems(name) { return getItemCollection(name).then(result => { console.log("STAC Item Collection: "); console.log(result); var items = []; console.log(result.links.length); for (let i = 0; i < result.links.length; i++) { if (result.links[i].rel == 'item') { fetch(result.links[i].href) .then(response => response.json()) .then(data => items.push(data)) } } console.log(items); return items; }); } // function getStacItems(name) { // return getItemCollection(name).then(result => { // console.log("STAC Item Collection: "); // console.log(result); // var items = []; // console.log(result.links.length); // for (let i = 0; i < result.links.length; i++) { // if (result.links[i].rel == 'item') { // fetch(result.links[i].href) // .then(response => response.json()) // .then(data => items.push(data)) // } // } // console.log(items); // return items; // }); // } export{ getStacItems }; export{ getItemCollection }; app/src/js/AstroMap.js +20 −10 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ import "proj4leaflet"; import AstroProj from "./AstroProj"; import LayerCollection from "./LayerCollection"; import { getStacItems } from "./ApiJsonCollection"; import { getItemCollection } from "./ApiJsonCollection"; import { MY_JSON_MAPS } from "./layers"; /** Loading Loading @@ -121,15 +121,25 @@ export default L.Map.AstroMap = L.Map.extend({ loadFootprintLayer: function(name) { var footprintLayer = L.geoJSON().addTo(this); getStacItems(name).then(footprints => { // wait 3 seconds to fully grab array of stac items setTimeout(() => { for (let i = 0; i < footprints.length; i++) { footprintLayer.addData(footprints[i]); getItemCollection(name).then(result => { console.log("STAC Item Collection: "); console.log(result); for (let i = 0; i < result.links.length; i++) { if (result.links[i].rel == 'item') { fetch(result.links[i].href) .then(response => response.json()) .then(data => footprintLayer.addData(data)) } } }, 3000); }) }); // // wait 3 seconds to fully grab array of stac items // setTimeout(() => { // console.log(footprints.length) // for (let i = 0; i < footprints.length; i++) { // footprintLayer.addData(footprints[i]); // } // }, 3000); // }) }, /** Loading Loading
app/src/js/ApiJsonCollection.js +18 −18 Original line number Diff line number Diff line Loading @@ -71,23 +71,23 @@ function getItemCollection(name) { } } function getStacItems(name) { return getItemCollection(name).then(result => { console.log("STAC Item Collection: "); console.log(result); var items = []; console.log(result.links.length); for (let i = 0; i < result.links.length; i++) { if (result.links[i].rel == 'item') { fetch(result.links[i].href) .then(response => response.json()) .then(data => items.push(data)) } } console.log(items); return items; }); } // function getStacItems(name) { // return getItemCollection(name).then(result => { // console.log("STAC Item Collection: "); // console.log(result); // var items = []; // console.log(result.links.length); // for (let i = 0; i < result.links.length; i++) { // if (result.links[i].rel == 'item') { // fetch(result.links[i].href) // .then(response => response.json()) // .then(data => items.push(data)) // } // } // console.log(items); // return items; // }); // } export{ getStacItems }; export{ getItemCollection };
app/src/js/AstroMap.js +20 −10 Original line number Diff line number Diff line Loading @@ -3,7 +3,7 @@ import "proj4leaflet"; import AstroProj from "./AstroProj"; import LayerCollection from "./LayerCollection"; import { getStacItems } from "./ApiJsonCollection"; import { getItemCollection } from "./ApiJsonCollection"; import { MY_JSON_MAPS } from "./layers"; /** Loading Loading @@ -121,15 +121,25 @@ export default L.Map.AstroMap = L.Map.extend({ loadFootprintLayer: function(name) { var footprintLayer = L.geoJSON().addTo(this); getStacItems(name).then(footprints => { // wait 3 seconds to fully grab array of stac items setTimeout(() => { for (let i = 0; i < footprints.length; i++) { footprintLayer.addData(footprints[i]); getItemCollection(name).then(result => { console.log("STAC Item Collection: "); console.log(result); for (let i = 0; i < result.links.length; i++) { if (result.links[i].rel == 'item') { fetch(result.links[i].href) .then(response => response.json()) .then(data => footprintLayer.addData(data)) } } }, 3000); }) }); // // wait 3 seconds to fully grab array of stac items // setTimeout(() => { // console.log(footprints.length) // for (let i = 0; i < footprints.length; i++) { // footprintLayer.addData(footprints[i]); // } // }, 3000); // }) }, /** Loading