Skip to content

Get Features

Retrieve one or more features using feature IDs and the corresponding layer ID.

https://api3.geo.admin.ch/rest/services/api/MapServer/{layerBodId}/{featureId},{featureId}

Request Details

To interact with the get features service, you need to provide specific parameters in your request. These parameters are divided into path parameters, which are required and part of the URL, and query parameters, which are optional and modify the behavior of the request.

Path Parameters

ParametersDescription
layerBodId (required)The id of the layer
featureId (required)The object’s Id (separated by comma for multiple objects)

Query Parameters

ParametersDescription
geometryFormat (optional)Returned geometry format. Default to ESRI geometry format. Supported values are: "esrijson" or "geojson".
returnGeometry (optional)This parameter defines whether the geometry is returned or not. Default to "true".
sr (optional)The spatial reference. Supported values: 21781 (LV03), 2056 (LV95), 4326 (WGS84) and 3857 (Web Pseudo-Mercator). Defaults to "21781".
lang (optional)The language. Supported values: de, fr, it , rm, en. Defaults to "de".
callback (optional)The name of the callback function.

Examples

Get the feature with the ID RIG belonging to the layer ch.bafu.nabelstationen:

Request
Response
sh
$ curl https://api3.geo.admin.ch/rest/services/api/MapServer/ch.bafu.nabelstationen/RIG

Get several features with IDs RIG and LAU belonging to the layer ch.bafu.nabelstationen:

Request
Response
sh
$ curl https://api3.geo.admin.ch/rest/services/api/MapServer/ch.bafu.nabelstationen/RIG,LAU

A GeoJSON in EPSG:4326:

Request
Response
sh
$ curl https://api3.geo.admin.ch/rest/services/api/MapServer/ch.bafu.nabelstationen/RIG,LAU?sr=4326&geometryFormat=geojson