@swissgeo/api
v1.0.2
Published
API utilities to interact with SWISSGEO's backend services
Readme
@swissgeo/api
API utilities to interact with SWISSGEO's backend services.
This package provides a collection of functions and types to interact with various SWISSGEO services, including search, elevation (height), profile, print, and more.
Installation
pnpm add @swissgeo/apiPeer dependencies
Most functions that deal with coordinates require the @swissgeo/coordinates package to access the coordinate transformation utilities.
pnpm add @swissgeo/coordinatesFeatures
This package provides utilities for:
- Features: Interaction with geographic features.
- Feedback: Sending feedback to the platform.
- Files: KML file management. Aimed at the drawing tools on map.geo.admin.ch.
- Height: Requesting elevation at specific coordinates.
- Icons: Accessing platform icons.
- LV03 Reframe: Coordinate transformation (LV03 <-> LV95).
- Print: Interacting with MapFish Print services.
- Profile: Requesting elevation profiles.
- QR Code: Generating QR codes.
- Search: Searching for locations, layers, and features (in layers).
- Shortlink: Generating and resolving shorten URL.
- Topics: Accessing map topics and layers metadata.
- What3Words: Integration with What3Words services.
Usage (some samples)
Search API
import { LV95 } from '@swissgeo/coordinates'
import { searchAPI } from '@swissgeo/api'
const results = await searchAPI.search({
queryString: "Bern",
outputProjection: LV95,
lang: 'en',
// in m/px, you can get this from your OpenLayers instance by calling map.getView().getResolution()
resolution: 1000
})Height API
import { LV95, WGS84 } from '@swissgeo/coordinates'
import { heightAPI } from '@swissgeo/api'
const elevation = await getHeightForPosition([2600000, 1200000], LV95)
const elevationWGS84 = await getHeightForPosition([7.530, 46.627], WGS84)License
BSD-3-Clause
