Examples
Working examples for integrating the Geog API into web, framework, and mobile applications. Web and framework examples follow a three-step pattern: token exchange, vector tile rendering, and places search. Mobile examples use direct API-key auth with bundle ID restrictions instead of token exchange.
Integration Pattern
All examples follow this flow:
- Token exchange (web/framework examples) — your backend exchanges a long-lived API key for a short-lived access token via
POST /v1/auth/token. The token is cached and refreshed at 80% of its TTL so requests never use an expired credential. - Bundle ID restrictions (mobile examples) — the app sends its API key directly with an
X-App-Bundle-Idheader. The API rejects requests whose bundle/application ID doesn't match the token's allowed list. No token exchange required. - Map rendering — configure your map library to fetch Geog vector tiles with the access token or API key
- Places search — query
POST /v1/places/searchwith text and a map-center location, then display results as markers
Map Styles
All examples use the Light theme by default. Geog provides four hosted styles — swap the URL path segment to change themes:
| Theme | Style URL |
|---|---|
| Light | https://assets.geog.dev/styles/v0/light.json |
| Dark | https://assets.geog.dev/styles/v0/dark.json |
| Gray | https://assets.geog.dev/styles/v0/gray.json |
| Warm | https://assets.geog.dev/styles/v0/warm.json |
Each style includes 109 layers, matching sprites, and glyphs. See the Styles & Sprites guide for full details, npm packages, and custom style options.
Examples
| Platform | Library | Directory | Guide |
|---|---|---|---|
| Web (Node.js) | MapLibre GL JS | `web/maplibre` | Web Guide |
| Web (Node.js) | Leaflet | `web/leaflet` | Web Guide |
| Web (Node.js) | OpenLayers | `web/openlayers` | Web Guide |
| Next.js 15 | MapLibre + React 19 | `frameworks/nextjs-maplibre` | Next.js Guide |
| Angular 19 | MapLibre | `frameworks/angular-maplibre` | Angular Guide |
| SvelteKit 2 | MapLibre + Svelte 5 | `frameworks/sveltekit-maplibre` | SvelteKit Guide |
| iOS | MapLibre Native (Swift) | `mobile/ios-maplibre` | iOS Guide |
| Android | MapLibre Native (Kotlin) | `mobile/android-maplibre` | Android Guide |
Getting the Examples
git clone https://github.com/geogdev/examples.git
cd examples
Each example directory is self-contained with its own dependencies and README.
API Endpoints Used
Examples use these endpoints:
| Endpoint | Method | Purpose | Stability |
|---|---|---|---|
/v1/auth/token | POST | Exchange API key for short-lived access token (web/framework examples only) | Stable |
/v1/tiles/basemap/{z}/{x}/{y}.mvt | GET | Fetch vector tiles | Stable |
/v1/places/search | POST | Search places by text and location | Preview — will change |
See Also
- Token Exchange API — Endpoint specification for short-lived tokens
- Authentication — How API authentication works
- Errors — Error codes and handling patterns