Quick start
Prerequisites πβ
Before you begin, ensure you meet the following requirements for using the SkyPath Web SDK:
- Access to SkyPath NPM package @yamasee/skypath-sdk-web
- Node.js and NPM installed on your machine
- Authentication credentials to access the SkyPath platform
Installation π¦β
To install the SkyPath Web SDK, use your preferred package manager:
- NPM
- Yarn
- pNPM
npm install @yamasee/skypath-sdk-web
yarn add @yamasee/skypath-sdk-web
pnpm add @yamasee/skypath-sdk-web
Alternatively, add the dependency into your package.json
file:
{
"dependencies": {
"@yamasee/skypath-sdk-web": "^0.3.0"
}
}
If you encounter any access issues, refer to our troubleshooting guide.
Importing the SDKβ
To use the SDK in your project, import it as follows:
import createSkyPathSDK from "@yamasee/skypath-sdk-web";
Initialization π οΈβ
The createSkyPathSDK
function is your entry point for initializing the SDK. It authenticates and configures the SDK with your specific settings.
For more details on authentication options, please see the SDK configuration documentation.
The function returns a promise, resolving to an object containing factory functions for various flows (e.g. Nowcasting or Observations).
// Initialize the SDK with your API key and other details
const sdk = await createSkyPathSDK({
apiBaseUrl: "YOUR_API_BASE_URL",
apiKey: "YOUR_API_KEY", // use api key for dev purposes only. for production, use signed auth option. see configuration section for more details.
userId: "YOUR_USER_ID",
companyName: "YOUR_COMPANY_NAME",
});
Usage πβ
Once the SDK is initialized, you can use the returned object to interact with the SkyPath platform. Start by selecting the specific workflow (Flow) you wish to use.
For a complete list of available Flows, see the Flows documentation.
For example, letβs initialize the Nowcasting Flow to get predictions of turbulence intensity.
First, initialize the Nowcasting Flow using the createNowcastingFlow
factory method:
const nowcastingFlow = sdk.createNowcastingFlow();
Next, subscribe to the onData
event to receive real-time data updates:
nowcastingFlow.onData((data) => {
// Your code here
});
To start the flow and begin receiving data, use the start
method:
nowcastingFlow.start();
You can update the configuration at any time using updateConfig
method. For example, to change the polygon area for which you want to receive predictions:
nowcastingFlow.updateConfig({ polygon });
To pause the flow and stop data updates, use the stop
method:
nowcastingFlow.stop();
The stop
method pauses the flow without terminating it. You can resume the flow anytime by calling start
again.
When you're done with the flow, make sure to clean up by calling terminate:
nowcastingFlow.terminate();
β¨ Congratulations!
Youβve successfully integrated the SkyPath Web SDK into your project and initialized the Nowcasting Flow to receive real-time turbulence intensity predictions. You can now use this data in your application for visualizations, such as map displays or analytics dashboards.