Skip to content

Commit 96953bf

Browse files
Merge pull request #57 from geoadmin/feat-PB-1584-explore-data-examples
PB-1934: add ExampleCodeBlock to explore data section #patch
2 parents c5befcd + d871d48 commit 96953bf

File tree

3 files changed

+199
-36
lines changed

3 files changed

+199
-36
lines changed

docs/get-layer-attributes.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,9 @@ Here is a description of the data contained in the response.
4545

4646
Get all the attributes for layer `ch.swisstopo.swissboundaries3d-land-flaeche.fill`
4747

48-
```sh
49-
curl https://api3.geo.admin.ch/rest/services/api/MapServer/ch.swisstopo.swissboundaries3d-land-flaeche.fill
50-
```
51-
52-
Response example:
53-
54-
```json
55-
{
48+
<ExampleCodeBlock
49+
request="curl https://api3.geo.admin.ch/rest/services/api/MapServer/ch.swisstopo.swissboundaries3d-land-flaeche.fill"
50+
example='{
5651
"id": "ch.swisstopo.swissboundaries3d-land-flaeche.fill",
5752
"name": "National boundaries",
5853
"fields": [
@@ -81,10 +76,8 @@ Response example:
8176
"values": [264, 763, 16048, 4129069]
8277
}
8378
]
84-
}
85-
```
86-
87-
<br>
79+
}'
80+
/>
8881

8982
Get the same legend using JSONP:
9083

docs/get-layer-legend.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,11 @@ No CSS styling is applied by default, allowing you to integrate the legend seaml
3838

3939
Get the legend for `ch.bafu.nabelstationen`:
4040

41-
```sh
42-
$ curl https://api3.geo.admin.ch/rest/services/api/MapServer/ch.bafu.nabelstationen/legend
43-
```
44-
45-
Response example:
41+
<ExampleCodeBlock
42+
request="curl https://api3.geo.admin.ch/rest/services/api/MapServer/ch.bafu.nabelstationen/legend"
43+
exampleLang='html'
44+
example='<div class="legend-container">
4645

47-
```html
48-
<div class="legend-container">
4946
<div class="legend-header">
5047
<p class="bod-title">
5148
<span
@@ -135,10 +132,8 @@ Response example:
135132
</tr>
136133
</table>
137134
</div>
138-
</div>
139-
```
140-
141-
<br>
135+
</div>'
136+
/>
142137

143138
Get the same legend using JSONP:
144139

docs/get-layer-metadata.md

Lines changed: 188 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,197 @@ and attributes listing more metaadata
5757

5858
List all the layers available in the GeoAdmin API:
5959

60-
```sh
61-
$ curl https://api3.geo.admin.ch/rest/services/api/MapServer
62-
```
63-
64-
<br>
60+
<ExampleCodeBlock
61+
request="curl https://api3.geo.admin.ch/rest/services/api/MapServer"
62+
example='{
63+
"mapName": "api",
64+
"description": "Configuration for the map (topic) api",
65+
"copyrightUnicode": "Data api",
66+
"layers": [
67+
{
68+
"attributes": {
69+
"inspireAbstract": "Soil",
70+
"fullTextSearch": "Estimate of (...)",
71+
"inspireName": "Soil",
72+
"wmsContactAbbreviation": "swisstopo",
73+
"wmsContactName": "Federal Office of Topography swisstopo",
74+
"maps": "api,ech,inspire,service-wms",
75+
"wmsUrlResource": "https://wms.geo.admin.ch/?REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.3.0",
76+
"scaleLimit": "1:100000",
77+
"dataOwner": "Agroscope",
78+
"urlDetails": "https://www.geocat.ch/geonetwork/srv/api/records/0572e842-7e34-409a-90d9-526d012a1c2d/attachments/W%C3%BCst-Galley%20Leifeld%202025%20org%20soils%20map.pdf",
79+
"dataStatus": "20241031",
80+
"inspireUpperAbstract": "Environment, biology and geology",
81+
"abstract": "Estimate of Switzerlands Organic Soil Surface, 2025The 2025 estimate of Switzerlands organic soil surface is an update of the 2015 estimate of organic soils. As in the 2015 map, it used the approach of collating existing information sources (e.g., soil maps, geology maps, forest habitat maps, historical observations of peatlands, as well as inventories of fens and raised bogs) to generate an estimate or the current extent of organic soils. In a first step, four important data sets were updated: Soil maps, geology maps, the national inventory of raised and transitional bogs, and the forest habitat maps. In a second step, all data sets were harmonized and inserted into a data model, allowing the semi-automatic combination of the various data sets. In a third step, the data sets were combined (more specifically, overlain) and a rule-based method was used to characterise the resulting surfaces as organic soil, or not organic soil. In a fourth step, information on the mineral soil surface was used to delete surfaces for which the evidence of mineral soil was stronger. The soil surface recommended for use in most applications is 32,702 ha, which corresponds to the ‘less conservative estimate or organic soils. Because of the heterogeneous nature of the information sources that were used to generate this indicator map, it is not possible to define the scale for which this map is appropriate. The following recommendation can however be made: The map is suitable for use at the regional scale (e.g., cantonal or district, ca. 1:100,000) and larger scale only; it is unsuitable for field-scale use. The two publications (Wüst-Galley, C. and J. Leifeld (2025) “The distribution and (future) use of Switzerlands organic soils” Mires and Peat 32(4): 1-17, DOI: 10.19189/001c.130819 and Wüst-Galley, C., A. Grünig and J. Leifeld (2015) “Locating organic soils for the greenhouse gas inventory” Agroscope Science 26, 100 pp.) describe the methodology and updated data sets in detail, and it is strongly recommended that both publications should be read by anybody wanting to use this data set. Parts of the data are subject to a licence. Please read the additional documentation.",
82+
"downloadUrl": "https://data.geo.admin.ch/browser/index.html#/collections/ch.agroscope.abschaetzung-organische_boeden",
83+
"inspireUpperName": "Environment, biology and geology"
84+
},
85+
"layerBodId": "ch.agroscope.abschaetzung-organische_boeden",
86+
"idGeoCat": "0572e842-7e34-409a-90d9-526d012a1c2d",
87+
"name": "Organic soils CH 2024",
88+
"fullName": "Estimate of Switzerlands Organic Soil Surface, 2025"
89+
},
90+
(... more layers ...)
91+
],
92+
"spatialReference": {
93+
"wkid": 21781
94+
},
95+
"tileInfo": {},
96+
"initialExtent": {
97+
"xmin": 458000,
98+
"ymin": 76375,
99+
"xmax": 839125,
100+
"ymax": 312500,
101+
"spatialReference": {
102+
"wkid": 21781
103+
}
104+
},
105+
"fullExtent": {
106+
"xmin": 420000,
107+
"ymin": 30000,
108+
"xmax": 900000,
109+
"ymax": 350000,
110+
"spatialReference": {
111+
"wkid": 21781
112+
}
113+
},
114+
"units": "esriMeters",
115+
"capabilities": "Map"
116+
}'
117+
/>
65118

66119
Using searchText parameter to list all the layers available in the GeoAdmin API where the word "wasser" is found in their description:
67120

68-
```sh
69-
$ curl https://api3.geo.admin.ch/rest/services/api/MapServer?searchText=wasser
70-
```
71-
72-
<br>
121+
<ExampleCodeBlock
122+
request="curl https://api3.geo.admin.ch/rest/services/api/MapServer?searchText=wasser"
123+
example='{
124+
"mapName": "api",
125+
"description": "Configuration for the map (topic) api",
126+
"copyrightUnicode": "Data api",
127+
"layers": [
128+
{
129+
"attributes": {
130+
"inspireAbstract": "Soil",
131+
"fullTextSearch": "Wetness potential in the agricultural land, vector | Das Feuchtflächenpotential wurde anhand der Prozesse Wasserakkumulation und Versickerung beurteilt. Aus dem Höhenmodell (Swissalti3d © swisstopo) wurden Reliefparameter berechnet und Ebenen und Mulden modelliert. Das Potential der Versickerung wurde von Bodenkarten abgeleitet. Wo keine detaillierten Bodenkarten vorhanden waren, wurden geologische Karten und andere Surrogate in einem Expertenmodell überlagert und gewichtet. Der Vektor-Datensatz ist auf die vorwiegend landwirtschaftlich genutzten Feldblöcke zugeschnitten.Versickerung: 4 Klassen; Wasserakkumulation: 5 Klassen. Zitat: Szerencsits, E., Prasuhn, V., Churko, G., Herzog, F., Utiger, C., Zihlmann, U. et al. (2018). Karte potenzieller Feucht-Acker-Flächen der Schweiz. Agroscope Science, 72, 67. https://www.feuchtacker.ch/ | swisstopo | Federal Office of Topography swisstopo | Agroscope",
132+
"inspireName": "Soil",
133+
"wmsContactAbbreviation": "swisstopo",
134+
"wmsContactName": "Federal Office of Topography swisstopo",
135+
"maps": "api,ech,inspire,service-wms",
136+
"wmsUrlResource": "https://wms.geo.admin.ch/?REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.3.0",
137+
"scaleLimit": "Min 1:5000 – Max 1:25000",
138+
"dataOwner": "Agroscope",
139+
"dataStatus": "20230725",
140+
"inspireUpperAbstract": "Environment, biology and geology",
141+
"abstract": "Das Feuchtflächenpotential"
142+
},
143+
"layerBodId": "ch.agroscope.feuchtflaechenpotential-kulturlandschaft",
144+
"idGeoCat": "5188235f-c5c3-4628-9173-055824b65539",
145+
"name": "Wetness potential agricultural land",
146+
"fullName": "Wetness potential in the agricultural land, vector"
147+
},
148+
(... more layers ...)
149+
],
150+
"spatialReference": {
151+
"wkid": 21781
152+
},
153+
"tileInfo": {},
154+
"initialExtent": {
155+
"xmin": 458000,
156+
"ymin": 76375,
157+
"xmax": 839125,
158+
"ymax": 312500,
159+
"spatialReference": {
160+
"wkid": 21781
161+
}
162+
},
163+
"fullExtent": {
164+
"xmin": 420000,
165+
"ymin": 30000,
166+
"xmax": 900000,
167+
"ymax": 350000,
168+
"spatialReference": {
169+
"wkid": 21781
170+
}
171+
},
172+
"units": "esriMeters",
173+
"capabilities": "Map"
174+
}'
175+
/>
73176

74177
Find a layer by [geocat ID](https://www.geocat.ch):
75178

76-
```sh
77-
$ curl https://api3.geo.admin.ch/rest/services/api/MapServer?searchText=f198f6f6-8efa-4235-a55f-99767ea0206c
78-
```
179+
<ExampleCodeBlock
180+
request="curl https://api3.geo.admin.ch/rest/services/api/MapServer?searchText=f198f6f6-8efa-4235-a55f-99767ea0206c"
181+
example='{
182+
"mapName": "api",
183+
"description": "Configuration for the map (topic) api",
184+
"copyrightUnicode": "Data api",
185+
"layers": [
186+
{
187+
"attributes": {
188+
"urlApplication": "https://map.geo.admin.ch/?lang=de&topic=gewiss",
189+
"inspireAbstract": "Geology",
190+
"fullTextSearch": "Hydrogeological Map of Switzerland: Groundwater Resources 1:500000 | The Federal Office for the Environment (FOEN) is the body within the Swiss Geological Survey responsible for hydrogeology. The 1:500,000 Hydrogeological Map forms part of the GeoMaps series (GK500) and is divided into two sheets. The first (GK500-Hydro) represents the various groundwater resources in Switzerland and their productiveness. The second (GK500-Hydro_Vul) shows the vulnerability of the groundwater resources to the risk of pollution. The groundwater resources sheet also indicates the type of groundwater aquifer (karstic, jointed or unconsolidated rock), the most important springs and groundwater catchments as well as hydrodynamic information about the infiltration and exfiltration areas. The two sheets were originally published as Tables 8.6 and 8.7 of the Hydrological Atlas of Switzerland HADES (FOEN, 2004 and 2007). | Hydrogeologische Karte der Schweiz: Grundwasservorkommen 1:500000 | swisstopo | Federal Office of Topography swisstopo | Federal Office of Topography swisstopo",
191+
"inspireName": "Geology",
192+
"wmsContactAbbreviation": "swisstopo",
193+
"bundCollectionNumber": "46.6",
194+
"wmsContactName": "Federal Office of Topography swisstopo",
195+
"bundCollection": "Hydrogeologische Karte der Schweiz: Grundwasservorkommen 1:500000",
196+
"maps": "api,bafu,ech,geol,georessourcen,gewiss,inspire,schule,service-wms,swissmaponline,swisstopo",
197+
"wmsUrlResource": "https://wms.geo.admin.ch/?REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.3.0",
198+
"scaleLimit": "1:500000",
199+
"dataOwner": "Federal Office of Topography swisstopo",
200+
"urlDetails": "https://shop.swisstopo.admin.ch/en/maps/geological-maps/geomaps-500000",
201+
"dataStatus": "20081103",
202+
"inspireUpperAbstract": "Environment, biology and geology",
203+
"abstract": "The Federal Office for the Environment (FOEN) is the body within the Swiss Geological Survey responsible for hydrogeology. The 1:500,000 Hydrogeological Map forms part of the GeoMaps series (GK500) and is divided into two sheets. The first (GK500-Hydro) represents the various groundwater resources in Switzerland and their productiveness. The second (GK500-Hydro_Vul) shows the vulnerability of the groundwater resources to the risk of pollution. The groundwater resources sheet also indicates the type of groundwater aquifer (karstic, jointed or unconsolidated rock), the most important springs and groundwater catchments as well as hydrodynamic information about the infiltration and exfiltration areas. The two sheets were originally published as Tables 8.6 and 8.7 of the Hydrological Atlas of Switzerland HADES (FOEN, 2004 and 2007).",
204+
"downloadUrl": "https://data.geo.admin.ch/ch.swisstopo.geologie-hydrogeologische_karte-grundwasservorkommen",
205+
"inspireUpperName": "Environment, biology and geology"
206+
},
207+
"layerBodId": "ch.swisstopo.geologie-hydrogeologische_karte-grundwasservorkommen",
208+
"idGeoCat": "f198f6f6-8efa-4235-a55f-99767ea0206c",
209+
"name": "Groundwater Resources 500",
210+
"fullName": "Hydrogeological Map of Switzerland: Groundwater Resources 1:500000"
211+
}
212+
],
213+
"spatialReference": {
214+
"wkid": 21781
215+
},
216+
"tileInfo": {
217+
"rows": 256,
218+
"cols": 256,
219+
"dpi": 90.7,
220+
"format": "PNG,JPEG",
221+
"compressionQuality": null,
222+
"origin": {
223+
"x": 420000,
224+
"y": 350000
225+
},
226+
"spatialReference": {
227+
"wkid": 21781
228+
},
229+
"lods": []
230+
},
231+
"initialExtent": {
232+
"xmin": 458000,
233+
"ymin": 76375,
234+
"xmax": 839125,
235+
"ymax": 312500,
236+
"spatialReference": {
237+
"wkid": 21781
238+
}
239+
},
240+
"fullExtent": {
241+
"xmin": 420000,
242+
"ymin": 30000,
243+
"xmax": 900000,
244+
"ymax": 350000,
245+
"spatialReference": {
246+
"wkid": 21781
247+
}
248+
},
249+
"units": "esriMeters",
250+
"capabilities": "Map"
251+
}
252+
'
253+
/>

0 commit comments

Comments
 (0)