1.0.2 • Published 5 years ago

fsai-data-sdk v1.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

Foresight AI Data SDK for Javascript

Installation

npm install fsai-data-sdk

Usage

Get Data

Get data at a specific location

    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);
    

The getDataAt function returns a list of Dataset. Each Dataset object contains the data layers:

  • semantic2d: a DataGetter object to get the semantic 2d json data of the area.
  • dynamicObjects: a list of DataGetter object to get the dynamic object data.

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.

See also

1.0.2

5 years ago

1.0.1

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago