Skip to content

Commit dadfd61

Browse files
authored
Merge pull request #51 from geoadmin/ltclm_feedback
PB-1969: Rework api3 docs
2 parents 9d16534 + 522f8eb commit dadfd61

File tree

12 files changed

+157
-24
lines changed

12 files changed

+157
-24
lines changed

.vitepress/config.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ function exploreDataItems(): DefaultTheme.SidebarItem[] {
139139
return [
140140
{ text: "Get Layer Metadata", link: "/docs/get-layer-metadata" },
141141
{ text: "Get Layer Attributes", link: "/docs/get-layer-attributes" },
142+
{ text: "Get Layer Attribute Values", link: "/docs/get-layer-attribute-values" },
142143
{ text: "Get Layer Legend", link: "/docs/get-layer-legend" },
143144
];
144145
}

docs/find-features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ request='curl "https://api3.geo.admin.ch/rest/services/api/MapServer/find?"\
290290
"searchField=stn_label&"\
291291
"returnGeometry=false&"\
292292
"contains=false&"\
293-
"layerDefs={\"ch.swisstopo.amtliches-strassenverzeichnis\":\"com_fosnr=4307\"}"'
293+
"layerDefs=%7B%22ch.swisstopo.amtliches-strassenverzeichnis%22%3A%22com_fosnr%3D4307%22%7D"'
294294
example='{
295295
"results": [
296296
{

docs/get-elevation-profile.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ This endpoint only has query parameters that modify the behavior of the request,
2929
## Examples
3030

3131
<ExampleCodeBlock
32-
request='$ curl https://api3.geo.admin.ch/rest/services/profile.json?geom={%22type%22:%22LineString%22,%22coordinates%22:[[2550050,1206550],[2556950,1204150],[2561050,1207950]]}'
32+
request='$ curl -G "https://api3.geo.admin.ch/rest/services/profile.json" --data-urlencode "geom={\"type\":\"LineString\",\"coordinates\":[[2550050,1206550],[2556950,1204150],[2561050,1207950]]}"'
3333
example='[
3434
{
3535
"alts": {
@@ -66,6 +66,6 @@ example='[
6666
/>
6767

6868
<ExampleCodeBlock
69-
request='$ curl https://api3.geo.admin.ch/rest/services/profile.csv?geom={"type":"LineString","coordinates":[[2550050,1206550],[2556950,1204150],[2561050,1207950]]}'
69+
request='$ curl -G "https://api3.geo.admin.ch/rest/services/profile.csv" --data-urlencode "geom={\"type\":\"LineString\",\"coordinates\":[[2550050,1206550],[2556950,1204150],[2561050,1207950]]}"'
7070
example='profile.csv'
7171
/>

docs/get-layer-attribute-values.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Get Layer Attribute Values
2+
3+
The attribute values endpoint provides a preview of possible values for a specific attribute (field) of a given vector layer.
4+
This is useful for building filter UIs, dropdowns, or for understanding the data distribution in a layer.
5+
6+
<ApiCodeBlock url="https://api3.geo.admin.ch/rest/services/api/MapServer/{layerBodId}/attributes/{attributeName}" method="GET" />
7+
8+
## Request Details
9+
10+
To interact with the Layer Attribute Values service, you need to provide specific parameters in your request.
11+
This endpoint only has **Path Parameters** which are mandatory.
12+
13+
### Path Parameters
14+
15+
| Parameters | Description |
16+
| ------------------------------- | ----------------------------------------------------------------- |
17+
| **layerBodId (required)** | The technical name or the layer ID. |
18+
| **attributeName (required)** | The name of the attribute for which to retrieve values. |
19+
20+
## Response Details
21+
22+
The endpoint returns a **JSON** with information about the attribute values for the specified layer and attribute. The response includes an array of values. For attributes of type `DATE`, `INTEGER`, `NUMERIC` the endpoint returns the minimum and maximum values as a two-element array. For other attribute types the endpoint returns up to 50 distinct values, sorted alphabetically.
23+
24+
Here is a description of the data contained in the response.
25+
26+
| **Field** | **Description** |
27+
| ---------------- | -------------------------------------------------------------------- |
28+
| `values` | Array of attribute values |
29+
30+
## Examples
31+
32+
Get distinct values for the `egid` attribute from layer `ch.bfs.gebaeude_wohnungs_register`:
33+
34+
<ExampleCodeBlock
35+
request='curl https://api3.geo.admin.ch/rest/services/api/MapServer/ch.bfs.gebaeude_wohnungs_register/attributes/egid'
36+
example='{
37+
"values": [
38+
"1",
39+
"10",
40+
"100",
41+
"10000",
42+
"1000001",
43+
"1000002",
44+
"1000007",
45+
"1000008",
46+
"1000009",
47+
"100001",
48+
"1000011",
49+
"1000012",
50+
"1000013",
51+
"1000014",
52+
"1000015",
53+
"1000016",
54+
"1000017",
55+
"1000018",
56+
"1000019",
57+
"100002",
58+
"1000020",
59+
"1000021",
60+
"1000022",
61+
"1000024",
62+
"1000026",
63+
"1000027",
64+
"1000028",
65+
"1000029",
66+
"100003",
67+
"1000030",
68+
"1000031",
69+
"1000032",
70+
"1000033",
71+
"1000034",
72+
"1000035",
73+
"1000036",
74+
"1000038",
75+
"1000039",
76+
"1000040",
77+
"1000041",
78+
"1000042",
79+
"1000043",
80+
"1000044",
81+
"1000045",
82+
"1000046",
83+
"1000047",
84+
"1000048",
85+
"1000049",
86+
"100005",
87+
"1000050"
88+
]
89+
}'
90+
/>
91+
92+
<br>
93+
94+
Get the min and max value for the `garea` attribute from layer `ch.bfs.gebaeude_wohnungs_register`:
95+
96+
<ExampleCodeBlock
97+
request='curl "https://api3.geo.admin.ch/rest/services/api/MapServer/ch.bfs.gebaeude_wohnungs_register/attributes/garea"'
98+
example='{
99+
"values": [
100+
1,
101+
99431
102+
]
103+
}'
104+
/>

docs/get-layer-metadata.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ For each layer, there are some general identification properties
2727
| ------------ | --------------------------------------------------------------------------------------- |
2828
| `name` | The name of the layer (short name, less than 30 characters). |
2929
| `fullName` | The layer's full name (not necessarily different from `name`). |
30-
| `idGeoCat` | The associated metadata ID in [GeoCat](http://www.geocat.ch/geonetwork/srv/eng/geocat). |
30+
| `idGeoCat` | The associated metadata ID in [GeoCat](https://www.geocat.ch). |
3131
| `layerBodId` | The technical name or BOD ID. |
3232

3333
and attributes listing more metaadata
@@ -36,20 +36,20 @@ and attributes listing more metaadata
3636
| ------------ | --------------------------------------------------------------------------------------- |
3737
| `wmsResource` | The WMS resource of the layer. |
3838
| `scaleLimit` | The scale at which the layer is valid. |
39-
| `inspireUpperAbstract` | The abstract of the [INSPIRE](https://www.geo.admin.ch/en/geo-information-switzerland/geodata-index-inspire.html) category (first level). |
40-
| `inspireName` | The name of the [INSPIRE](https://www.geo.admin.ch/en/geo-information-switzerland/geodata-index-inspire.html) category. |
39+
| `inspireUpperAbstract` | The abstract of the [INSPIRE](https://www.geo.admin.ch/en/inspire-services) category (first level). |
40+
| `inspireName` | The name of the [INSPIRE](https://www.geo.admin.ch/en/inspire-services) category. |
4141
| `urlDetails` | Link to the official details page. |
4242
| `bundCollectionNumber` | The collection number. |
4343
| `dataOwner` | The data owner. |
44-
| `inspireAbstract` | The abstract of the [INSPIRE](https://www.geo.admin.ch/en/geo-information-switzerland/geodata-index-inspire.html) category the layer belongs to. |
44+
| `inspireAbstract` | The abstract of the [INSPIRE](https://www.geo.admin.ch/en/inspire-services) category the layer belongs to. |
4545
| `abstract` | The layer abstract. |
4646
| `wmsContactAbbreviation` | The abbreviation contact for the WMS resource. |
4747
| `downloadUrl` | The link where the data can be downloaded. |
4848
| `maps` | The projects in which this layer is accessible. |
4949
| `wmsContactName` | The contact name for the WMS resource. |
5050
| `dataStatus` | The date of the latest data update. |
5151
| `bundCollectionName` | The collection name. |
52-
| `inspireUpperName` | The name of the [INSPIRE](https://www.geo.admin.ch/en/geo-information-switzerland/geodata-index-inspire.html) category (first level). |
52+
| `inspireUpperName` | The name of the [INSPIRE](https://www.geo.admin.ch/en/inspire-services) category (first level). |
5353
| `urlApplication` | The application where this layer is published. |
5454
| `tileInfo` | WMTS general information in JSON format. Note that this section is always identical and is not tied to a particular "map" like in ESRI specifications. |
5555

@@ -71,7 +71,7 @@ $ curl https://api3.geo.admin.ch/rest/services/api/MapServer?searchText=wasser
7171

7272
<br>
7373

74-
Find a layer by [geocat ID](http://www.geocat.ch/geonetwork/srv/eng/geocat):
74+
Find a layer by [geocat ID](https://www.geocat.ch):
7575

7676
```sh
7777
$ curl https://api3.geo.admin.ch/rest/services/api/MapServer?searchText=f198f6f6-8efa-4235-a55f-99767ea0206c

docs/get-point-height.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Retrieve the elevation for a specific coordinate.
55
<ApiCodeBlock url="https://api3.geo.admin.ch/rest/services/height" method="GET" />
66
::: info
77
Outside of Switzerland a 10m grid elevation model is used. It is a combined digital elevation model consisting of elevation models from mapping agencies of France, Italy, Austria, Bavaria and Baden-Württemberg and derived with a resolution of 10m. The extend
8-
covers XMin: 2443000 YMin: 1024000 XMax: 2895000 YMax: 1340000
8+
covers XMin: 2'385'000 YMin: 974'000 XMax: 2'935'000 YMax: 1'404'000
99

1010
See [Height models](https://www.swisstopo.admin.ch/en/geodata/height/alti3d.html) for more details about data used by this service.
1111
:::

docs/identify-features.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Use this endpoint to discover features at a specific location.
55
<ApiCodeBlock url="https://api3.geo.admin.ch/rest/services/api/MapServer/identify" method="GET" />
66

77
::: warning
8-
No more than 50 features can be retrieved per request.
8+
No more than 200 features can be retrieved per request.
99
:::
1010

1111
## Request Details
@@ -26,6 +26,7 @@ This endpoint only has query parameters that modify the behavior of the request,
2626
| **returnGeometry (optional)** | This parameter defines whether the geometry is returned or not. Defaults to `true`. |
2727
| **geometryFormat (optional)** | Returned geometry format. Defaults to ESRI geometry format. Supported values are: `esrijson` or `geojson`. |
2828
| **offset (optional)** | Offset for the first record (if more than 50 records). |
29+
| **limit (optional)** | The maximum number of results to retrieve per request (default limit=50, max limit=200) |
2930
| **sr (optional)** | The spatial reference. Supported values: `21781` (LV03), `2056` (LV95), `4326` (WGS84), and `3857` (Web Pseudo-Mercator). Defaults to `21781`. |
3031
| **lang (optional)** | The language. Supported values: `de`, `fr`, `it`, `rm`, `en`. Defaults to `de`. |
3132
| **layerDefs (optional)** | Filter features with an expression. Syntax: `{ "<layerId>" : "<layerDef1>" }` where `<layerId>` must correspond to the layer specified in `layers`. See below for more details. |

docs/search.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Here is a description of the response's data.
7979
| **Field** | **Description** |
8080
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
8181
| `id` | This is an internal value and therefore shouldn't be used. |
82-
| `weight` | The `weight` is dynamically computed according to the `searchText` that is provided. It informs the user about how close an entry is to the provided `searchText`. |
82+
| `weight` | The `weight` attribute represents the similarity between the search query and the index. **For location search**: `weight = 100` typically indicates exact matches, `weight < 100` indicates partial/wildcard matches, `weight > 1000` indicates fuzzy search results. Since the search engine combines multiple ranking methods, weight values should be used as general guidelines only. **Important**: Absolute weight values may change without backward compatibility. |
8383

8484
**Attributes:**
8585
| **Field** | **Description** |

docs/vector-tiles.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ curl -o demo.pbf https://vectortiles.geo.admin.ch/tiles/ch.swisstopo.relief.vt/v
6767
```
6868

6969
## GetTileSets
70+
MBTiles are used for storing tiled map data in SQLite databases for immediate or offline usage and for efficient transfer.
7071

71-
MBTiles for storing tiled map data in SQLite databases for immediate or offline usage and for efficient transfer.
72-
A MBtileSet request is in the following form:
72+
TileSet request is in the following form:
7373

7474
<ApiCodeBlock url="https://vectortiles.geo.admin.ch/tiles/{layerName}/{version}/{layerName}.mbtiles" method="GET" />
7575

@@ -80,6 +80,10 @@ A MBtileSet request is in the following form:
8080

8181
A GetTileSet request for a `.mbtiles` file in the Base Map dataset:
8282

83+
::: warning
84+
The file that is being downloaded in the example below is approximately **900MB** in size.
85+
:::
86+
8387
```http
8488
curl -o demo.mbtiles https://vectortiles.geo.admin.ch/tiles/ch.swisstopo.base.vt/v1.0.0/ch.swisstopo.base.vt.mbtiles
8589
```
@@ -100,7 +104,7 @@ The URL of the metadata file is:
100104
A Metadata request for the Base Map dataset:
101105

102106
<ExampleCodeBlock
103-
request="curl https://vectortiles.geo.admin.ch/tiles/ch.swisstopo.base.vt/v1.0.0/tiles.json"
107+
request="curl --compressed https://vectortiles.geo.admin.ch/tiles/ch.swisstopo.base.vt/v1.0.0/tiles.json"
104108
example='{
105109
"basename": "tiles/ch.swisstopo.base.vt/v1.0.0",
106110
"name": "Basiskarte_v1.0.0",

docs/wms.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,39 @@ outline: [2, 3]
77
Federal offices make part of their data available via the WMS - Federal Spatial Data Infrastructure (FSDI) service.
88
The data layers currently available in the WMS-FSDI correspond, with a few exceptions, to the geodata that are presented in [map.geo.admin.ch](https://map.geo.admin.ch).
99

10+
## Set the Language
11+
12+
The default response language of all WMS endpoints is German (`de`).
13+
There are two ways to set a different language:
14+
15+
1. As a path parameter like in `https://wms.geo.admin.ch/{Lang}/?SERVICE=WMS&...`
16+
2. As a query parameter `Lang` like in `https://wms.geo.admin.ch/?SERVICE=WMS&...&Lang=fr&...`
17+
18+
When both are present, the path parameter takes precedence over the query string parameter.
19+
20+
The supported values are: `de` (German), `fr` (French), `it` (Italian), `rm` (Rumantsch), `en` (English). Defaults to `de` if not specified
21+
22+
::: info
23+
The language parameter (both path and query string variants) is supported by all WMS requests: `GetCapabilities`, `GetMap`, `GetFeatureInfo`, and `GetLegendGraphic`. This allows you to receive localized responses and layer information in your preferred language.
24+
:::
25+
26+
<ApiCodeBlock url="https://wms.geo.admin.ch/{language}/?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities&LANG=<Lang>" method="GET" />
27+
1028
## GetCapabilities
1129

12-
The GetCapabilities document provides information about the service, along with layer description, both in German and French.
30+
The GetCapabilities document provides comprehensive information about the WMS service, including detailed layer descriptions available in all four Swiss national languages and English.
31+
32+
### Path Parameters
33+
34+
| Parameter | Description |
35+
| ------------------------- | ----------------------------------- |
36+
| **Lang** *(optional)* | Specifies the language for the service response. |
1337

14-
<ApiCodeBlock url="https://wms.geo.admin.ch/?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities&LANG=<Lang>" method="GET" />
38+
### Query Parameters
1539

16-
| **Parameter** | **Description** |
40+
| Parameter | Description |
1741
| --------------- | ------------------------------------------------------------- |
18-
| Lang (optional) | The language. Supported values: `de`, `fr` (Defaults to `de`) |
42+
| **Lang** *(optional)* | Specifies the language for the service response. |
1943

2044
### Supported Projections
2145

0 commit comments

Comments
 (0)