Getting Started

Getting Started

yarn add @xweather/map-ui-sdk

Example Project

map-ui-sdk includes an example project that demonstrates how to use the SDK with a mapping library. The example project is located in the example directory, separate from the SDK implementation code. Follow the steps below to get the example project up and running:

Prerequisites

Steps to Run

  1. Get Xweather MapsGL ID and Secret Log into your Xweather account, and from your account's Apps page (opens in a new tab), create a new application for the MapsGL Demo app. Make note of application's Xweather MapsGL ID and Secret; you'll need them in step 5.

  2. Get Xweather Mapbox public access token The example project relies on Mapbox, so you'll need to log into or create a Mapbox (opens in a new tab) account and follow the instructions to create a Mapbox public access token (opens in a new tab).

  3. Navigate to the Example Directory After downloading or cloning map-ui-sdk from npm, navigate to the example directory within the SDK:

> cd ./example
  1. Install Dependencies Once you're in the example directory, install the project's dependencies by running:
> yarn install
  1. Update environment variables Rename .env.template at the root of the example repo to .env and add the necessary Xweather and Mapbox access keys:
VITE_MAPBOX_KEY=''
VITE_MAPSGL_ID=''
VITE_MAPSGL_SECRET=''
  1. Import styles You will need to import this stylesheet at the root of your project: import '@xweather/map-ui-sdk/dist/style.css'

  2. Run the project in development mode:

> yarn dev