Foresight Data Portal for Javascript
npm install fsai-data-sdk
npm install fsai-data-sdk
javascript
const { DatasetService } = require('fsai-data-sdk');
const datasetService = new DatasetService({
apiKey: process.env.API_KEY, secret: process.env.SECRET,
});
const datasets = await datasetService.getDataAt({ lng: -122.1598309, lat: 37.4358347, radius: 2000 }, ['SEMANTIC_2D', 'DYNAMIC_OBJECTS']);
console.log(datasets);
const exampleDataset = datasets[0];
console.log(exampleDataset);
const exampleSemantic2D = await exampleDataset.layers.semantic2D.get();
console.log(exampleSemantic2D);
const exampleDynamicObject = await exampleDataset.layers.dynamicObjects[0].get();
console.log(exampleDynamicObject);
``#### DataGetter class
Because the data layers are normally large, they can't be returned directly in the getting data calls.
The SDK wrap the data layer in the DataGetter class which provides a get function to fetch
the data and return the actual data of the layer.
* Rest API: https://data.foresight.ai/docs/public/api/