Package Exports
- @stadiamaps/api
Readme
Stadia Maps TypeScript APIs
This SDK helps you access the full range of geospatial APIs from Stadia Maps.
Getting started
First, add @stadiamaps/api as a dependency of your project using your favorite package manager
like npm or yarn. Something like this:
npm install --save @stadiamaps/apiThe library exposes 3 different API classes for grouping functionality: GeocodingApi,
GeospatialApi, and RoutingApi. These correspond to the sections in our online
API Reference.
All clients have the same interface and only expose different methods. Here is an example of getting started with the geocoding API:
// Imports: you need the API(s) that you intend to use at a minimum.
import { GeocodingApi, Configuration } from '@stadiamaps/api';
// If you writing a front-end web browser application, you can usually use our domain-based auth
// (see https://docs.stadiamaps.com/authentication/). This lets you skip the configuration app-side
// entirely. If you are writing for a backend application or can't use domain-based auth,
// then you'll need to add your API key as shown below.
const config = new Configuration({ apiKey: "YOUR-API-KEY" });
const api = new GeocodingApi(config);
// Make an API call! The responses use the standard promise API.
// You can use either the callback interface...
api.reverse({ pointLat: 59.44436, pointLon: 24.75071 }).then(function (result) {
console.log(result);
}, function (err) {
console.log(err);
});
// ... or the await keyword in an async context
const res = await api.search({ text: "Põhja pst 27a" });Documentation
TypeScript hints and autocomplete only go so far. Check out our official documentation at docs.stadiamaps.com for both long-form prose explanation of the finer details and a compact API reference.
Developing
Refer to DEVELOPING.md for details on local development.