The official Python fsai_data_sdk library for accessing Foresight Data Portal
Project description
Foresight Data Portal for Python
===================
Installation
------
`
$ pip install --upgrade fsai_data_sdk
`
Usage
------
## Get Data
### Get data at a specific location
```python
import fsai_data_sdk as ForesightDataPortal
portal = ForesightDataPortal(API_KEY, SECRET_KEY)
datasets = portal.get_data_at(lng=-122.1598309, lat=37.4358347, radius=2000, layers=["SEMANTIC_2D", "DYNAMIC_OBJECTS"])
print(len(datasets))
sample_dataset = datasets[0]
print(sample_dataset)
print(sample_dataset.layers.semantic_2d.get())
print(sample_dataset.layers.dynamic_objects[0].get())
```
The **get_data_at** function returns a list of **Dataset**. Each **Dataset** object contains the data layers:
* semantic_2d: a **DataGetter** object to get the semantic 2d json data of the area.
* dynamic_objects: a list of **DataGetter** object to get the array of dynamic_object.
### 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.
`
===================
Installation
------
`
$ pip install --upgrade fsai_data_sdk
`
Usage
------
## Get Data
### Get data at a specific location
```python
import fsai_data_sdk as ForesightDataPortal
portal = ForesightDataPortal(API_KEY, SECRET_KEY)
datasets = portal.get_data_at(lng=-122.1598309, lat=37.4358347, radius=2000, layers=["SEMANTIC_2D", "DYNAMIC_OBJECTS"])
print(len(datasets))
sample_dataset = datasets[0]
print(sample_dataset)
print(sample_dataset.layers.semantic_2d.get())
print(sample_dataset.layers.dynamic_objects[0].get())
```
The **get_data_at** function returns a list of **Dataset**. Each **Dataset** object contains the data layers:
* semantic_2d: a **DataGetter** object to get the semantic 2d json data of the area.
* dynamic_objects: a list of **DataGetter** object to get the array of dynamic_object.
### 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.
`
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fsai_data_sdk-0.1.3.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for fsai_data_sdk-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79414f0b90effd75e2a9db036b235d7bf354ec49261fe2469fbfa6bc179a6968 |
|
MD5 | afc78da31c386f8a5cff3ab21c110bd9 |
|
BLAKE2b-256 | ff40d403deb5d5220c2d8f981d9a883001f1fdb4646ee3a33a44035d8bad0398 |