Skip to content

Commit b87b065

Browse files
Merge pull request #39 from geoadmin/feat-PB-1939-add-oereb-rdppf
PB-1939 Add OEREB #minor
2 parents c1195b5 + 9ef63d4 commit b87b065

3 files changed

Lines changed: 170 additions & 235 deletions

File tree

docs/identify-features.md

Lines changed: 168 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ This endpoint only has query parameters that modify the behavior of the request,
2828
| **offset (optional)** | Offset for the first record (if more than 50 records). |
2929
| **sr (optional)** | The spatial reference. Supported values: `21781` (LV03), `2056` (LV95), `4326` (WGS84), and `3857` (Web Pseudo-Mercator). Defaults to `21781`. |
3030
| **lang (optional)** | The language. Supported values: `de`, `fr`, `it`, `rm`, `en`. Defaults to `de`. |
31-
| **layerDefs (optional)** | Filter features with an expression. Syntax: `{ "<layerId>" : "<layerDef1>" }` where `<layerId>` must correspond to the layer specified in `layers`. |
31+
| **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. |
3232
| **callback (optional)** | The name of the callback function. |
3333

3434
### Tolerance, mapExtent and imageDisplay
@@ -42,23 +42,123 @@ The following table summarize the various combinations:
4242
| `tolerance=0` | No buffer & no scale | No buffer, but scale |
4343
| `tolerance>0` | Forbidden | Buffer & scale |
4444

45-
### layerDefs syntax
45+
### Filtering
4646

47-
To list the available attributes together with their types and examples values, use the [layer attribute endpoint](/docs/get-layer-attributes).
47+
To filter features on a set of attributes, we can use the `layerDefs` parameter on "queryable" layers.
4848

49-
Define the `layerDefs` parameter in JSON format like `{"<layername>":"<filter_expression>"}`.
49+
So-called "queryable" layers are:
5050

51-
The filter expression can consist of a single expression of the form `<attribute><operator><value>` or several of these expressions combined with boolean operators `and` and `or`, e.g. `state='open' and startofconstruction>='2018-10'`
51+
```txt
52+
ch.astra.unfaelle-personenschaeden_alle
53+
ch.astra.unfaelle-personenschaeden_fahrraeder
54+
ch.astra.unfaelle-personenschaeden_fussgaenger
55+
ch.astra.unfaelle-personenschaeden_getoetete
56+
ch.astra.unfaelle-personenschaeden_motorraeder
57+
ch.bafu.landesforstinventar-vegetationshoehenmodell
58+
ch.bafu.wrz-wildruhezonen_portal
59+
ch.bfe.solarenergie-eignung-daecher
60+
ch.bfe.solarenergie-eignung-fassaden
61+
ch.swisstopo.amtliches-gebaeudeadressverzeichnis
62+
ch.swisstopo.amtliches-strassenverzeichnis
63+
```
64+
65+
Regarding the format of the `layerDefs` parameter:
66+
67+
- Use a JSON-like format: `{"<layername>":"<filter_expression>"}`.
68+
- The `<filter_expression` is defined in the form `<attribute><operator><value>` where
69+
- `<attribute>` must be one of the queryable attributes listed by the [layer attribute endpoint](/docs/get-layer-attributes).
70+
- `<operator>` must be one of the following options:
5271

53-
`<attribute>` must be one of the queryable attributes, the type of `<value>` must correspond the type of the queryable attribute (see above) and `<operator>` can be one of the following options:
72+
| **Operator** | **Operators** | **Examples** |
73+
| ------------ | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
74+
| `varchar` | `=`, `+=`, `like`, `ilike`, `not like`, `not ilike`, `is null`, `is not null` | `toto = '3455 Kloten'`, `toto ilike '%SH%'`, `toto is null`, `toto ilike 'SH%'` |
75+
| `number` | `=`, `<`, `>`, `>=`, `<=`, `!=` | `tutu >= 2.4`, `tutu < 5` |
76+
| `boolean` | `is` (true/false), `is not` (true/false) | `tata is not false` |
77+
78+
- `<value>` must correspond to the type of the queryable attribute.
5479

55-
| **Operator** | **Operators** | **Examples** |
56-
| ------------ | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
57-
| `varchar` | `=`, `+=`, `like`, `ilike`, `not like`, `not ilike`, `is null`, `is not null` | `toto = '3455 Kloten'`, `toto ilike '%SH%'`, `toto is null`, `toto ilike 'SH%'` |
58-
| `number` | `=`, `<`, `>`, `>=`, `<=`, `!=` | `tutu >= 2.4`, `tutu < 5` |
59-
| `boolean` | `is` (true/false), `is not` (true/false) | `tata is not false` |
80+
In an example:
81+
82+
<ExampleCodeBlock
83+
request='curl "https://api3.geo.admin.ch/rest/services/all/MapServer/identify?"\
84+
"geometryType=esriGeometryEnvelope&"\
85+
"geometry=2548945.5,1147956,2549402,1148103.5&"\
86+
"geometryFormat=geojson&"\
87+
"imageDisplay=1367,949,96&"\
88+
"lang=en&"\
89+
"layers=all:ch.swisstopo.amtliches-strassenverzeichnis&"\
90+
"mapExtent=2318250,952750,3001750,1427250&"\
91+
"returnGeometry=false&"\
92+
"sr=2056&"\
93+
"tolerance=5&"\
94+
"layerDefs={\"ch.swisstopo.amtliches-strassenverzeichnis\":\"stn_label+ilike+%27%Corniche%%27\"}"'
95+
example='{
96+
"results": [
97+
{
98+
"layerBodId": "ch.swisstopo.amtliches-strassenverzeichnis",
99+
"layerName": "Official directory of streets",
100+
"featureId": 10035871,
101+
"id": 10035871,
102+
"properties": {
103+
"str_esid": 10035871,
104+
"stn_label": "Route de la Corniche",
105+
"zip_label": "1070 Puidoux, 1071 Chexbres, 1098 Epesses",
106+
"com_name": "Puidoux",
107+
"com_fosnr": 5607,
108+
"str_official": 1,
109+
"str_modified": "2024-10-15",
110+
"str_type": "Strasse",
111+
"str_children": null,
112+
"str_parent": null,
113+
"str_status": "bestehend",
114+
"label": "Route de la Corniche"
115+
}
116+
},
117+
{
118+
"layerBodId": "ch.swisstopo.amtliches-strassenverzeichnis",
119+
"layerName": "Official directory of streets",
120+
"featureId": 10048084,
121+
"id": 10048084,
122+
"properties": {
123+
"str_esid": 10048084,
124+
"stn_label": "Route de la Corniche",
125+
"zip_label": "1096 Cully, 1097 Riex, 1098 Epesses",
126+
"com_name": "Bourg-en-Lavaux",
127+
"com_fosnr": 5613,
128+
"str_official": 1,
129+
"str_modified": "2024-07-29",
130+
"str_type": "Strasse",
131+
"str_children": null,
132+
"str_parent": null,
133+
"str_status": "bestehend",
134+
"label": "Route de la Corniche"
135+
}
136+
},
137+
{
138+
"layerBodId": "ch.swisstopo.amtliches-strassenverzeichnis",
139+
"layerName": "Official directory of streets",
140+
"featureId": 10093805,
141+
"id": 10093805,
142+
"properties": {
143+
"str_esid": 10093805,
144+
"stn_label": "Route de la Corniche",
145+
"zip_label": "1071 Chexbres",
146+
"com_name": "Chexbres",
147+
"com_fosnr": 5601,
148+
"str_official": 1,
149+
"str_modified": "2024-07-29",
150+
"str_type": "Strasse",
151+
"str_children": null,
152+
"str_parent": null,
153+
"str_status": "bestehend",
154+
"label": "Route de la Corniche"
155+
}
156+
}
157+
]
158+
}'
159+
/>
60160

61-
#### Correct encoding
161+
#### Correct Encoding
62162

63163
It's important that the parameters are correctly serialized and url-encoded.
64164

@@ -345,87 +445,6 @@ example='{
345445
}'
346446
/>
347447

348-
Filter features with `layerDefs`:
349-
350-
<ExampleCodeBlock
351-
request='curl "https://api3.geo.admin.ch/rest/services/all/MapServer/identify?"\
352-
"geometryType=esriGeometryEnvelope&"\
353-
"geometry=2548945.5,1147956,2549402,1148103.5&"\
354-
"geometryFormat=geojson&"\
355-
"imageDisplay=1367,949,96&"\
356-
"lang=en&"\
357-
"layers=all:ch.swisstopo.amtliches-strassenverzeichnis&"\
358-
"mapExtent=2318250,952750,3001750,1427250&"\
359-
"returnGeometry=false&"\
360-
"sr=2056&"\
361-
"tolerance=5&"\
362-
"layerDefs={\"ch.swisstopo.amtliches-strassenverzeichnis\":\"stn_label+ilike+%27%Corniche%%27\"}"'
363-
example='{
364-
"results": [
365-
{
366-
"layerBodId": "ch.swisstopo.amtliches-strassenverzeichnis",
367-
"layerName": "Official directory of streets",
368-
"featureId": 10035871,
369-
"id": 10035871,
370-
"properties": {
371-
"str_esid": 10035871,
372-
"stn_label": "Route de la Corniche",
373-
"zip_label": "1070 Puidoux, 1071 Chexbres, 1098 Epesses",
374-
"com_name": "Puidoux",
375-
"com_fosnr": 5607,
376-
"str_official": 1,
377-
"str_modified": "2024-10-15",
378-
"str_type": "Strasse",
379-
"str_children": null,
380-
"str_parent": null,
381-
"str_status": "bestehend",
382-
"label": "Route de la Corniche"
383-
}
384-
},
385-
{
386-
"layerBodId": "ch.swisstopo.amtliches-strassenverzeichnis",
387-
"layerName": "Official directory of streets",
388-
"featureId": 10048084,
389-
"id": 10048084,
390-
"properties": {
391-
"str_esid": 10048084,
392-
"stn_label": "Route de la Corniche",
393-
"zip_label": "1096 Cully, 1097 Riex, 1098 Epesses",
394-
"com_name": "Bourg-en-Lavaux",
395-
"com_fosnr": 5613,
396-
"str_official": 1,
397-
"str_modified": "2024-07-29",
398-
"str_type": "Strasse",
399-
"str_children": null,
400-
"str_parent": null,
401-
"str_status": "bestehend",
402-
"label": "Route de la Corniche"
403-
}
404-
},
405-
{
406-
"layerBodId": "ch.swisstopo.amtliches-strassenverzeichnis",
407-
"layerName": "Official directory of streets",
408-
"featureId": 10093805,
409-
"id": 10093805,
410-
"properties": {
411-
"str_esid": 10093805,
412-
"stn_label": "Route de la Corniche",
413-
"zip_label": "1071 Chexbres",
414-
"com_name": "Chexbres",
415-
"com_fosnr": 5601,
416-
"str_official": 1,
417-
"str_modified": "2024-07-29",
418-
"str_type": "Strasse",
419-
"str_children": null,
420-
"str_parent": null,
421-
"str_status": "bestehend",
422-
"label": "Route de la Corniche"
423-
}
424-
}
425-
]
426-
}'
427-
/>
428-
429448
## Examples: Reverse Geocoding
430449

431450
The `identify` endpoint can be used for reverse geocoding operations.
@@ -659,3 +678,59 @@ example='{
659678
}
660679
'
661680
/>
681+
682+
## Download as INTERLIS
683+
684+
For a limited set of "ÖREB" layers, features can be retrieved in the INTERLIS format (XML) with `geometryFormat=interlis`.
685+
"ÖREB" is the German accronym for the [Cadastre of public-law restrictions on landownership](https://www.swisstopo.admin.ch/en/plr-cadastre).
686+
687+
:::warning
688+
The INTERLIS format is designed for specialized applications and may not be suitable for general use.
689+
For most users, we recommend using one of the following formats instead:
690+
691+
- `geometryFormat=geojson`
692+
- `geometryFormat=esrijson`
693+
694+
:::
695+
696+
The following layers are based on the [ÖREB model V2_0](https://models.geo.admin.ch/V_D/OeREB/OeREBKRMtrsfr_V2_0.ili) and offer features in the INTERLIS format:
697+
698+
- Layers with data:
699+
700+
```txt
701+
ch.astra.baulinien-nationalstrassen_v2_0.oereb
702+
ch.bazl.projektierungszonen-flughafenanlagen_v2_0.oereb
703+
ch.bazl.sicherheitszonenplan_v2_0.oereb
704+
ch.vbs.kataster-belasteter-standorte-militaer_v2_0.oereb
705+
ch.bazl.kataster-belasteter-standorte-zivilflugplaetze_v2_0.oereb
706+
ch.bav.kataster-belasteter-standorte-oev_v2_0.oereb
707+
```
708+
709+
- Layers without data:
710+
711+
```txt
712+
ch.astra.projektierungszonen-nationalstrassen_v2_0.oereb
713+
ch.bav.projektierungszonen-eisenbahnanlagen_v2_0.oereb
714+
ch.bav.baulinien-eisenbahnanlagen_v2_0.oereb
715+
ch.bazl.baulinien-flughafenanlagen_v2_0.oereb
716+
ch.bfe.projektierungszonen-starkstromanlagen_v2_0.oereb
717+
ch.bfe.baulinien-starkstromanlagen_v2_0.oereb
718+
```
719+
720+
### Example ÖREB Queries
721+
722+
Look for all the features of `ch.bazl.projektierungszonen-flughafenanlagen_v2_0.oereb` using a point:
723+
724+
https://api3.geo.admin.ch/rest/services/api/MapServer/identify?geometry=2682414.312,1257059.381&geometryType=esriGeometryPoint&layers=all:ch.bazl.projektierungszonen-flughafenanlagen_v2_0.oereb&mapExtent=2480000,1070000,2840000,1310000&imageDisplay=3600,2400,96&tolerance=0&geometryFormat=interlis&sr=2056
725+
726+
Look for all the features of `ch.bav.kataster-belasteter-standorte-oev_v2_0.oereb` using a polygon:
727+
728+
https://api3.geo.admin.ch/rest/services/api/MapServer/identify?geometry={"rings":[[[2675000,1245000],[2670000,1255000],[2680000,1260000],[2690000,1255000],[2685000,1240000],[2675000,1245000]]]}&geometryType=esriGeometryPolygon&layers=all:ch.bav.kataster-belasteter-standorte-oev_v2_0.oereb&mapExtent=2480000,1070000,2840000,1310000&imageDisplay=3600,2400,96&tolerance=0&geometryFormat=interlis&sr=2056
729+
730+
Look for all the features of `ch.bazl.sicherheitszonenplan_v2_0.oereb` using a bounding box (envelope):
731+
732+
https://api3.geo.admin.ch/rest/services/api/MapServer/identify?geometry=2575000,1109000,2610000,1127000&geometryType=esriGeometryEnvelope&layers=all:ch.bazl.sicherheitszonenplan_v2_0.oereb&mapExtent=2480000,1070000,2840000,1310000&imageDisplay=3600,2400,96&tolerance=0&geometryFormat=interlis&sr=2056
733+
734+
Look for all the features of `ch.astra.baulinien-nationalstrassen_v2_0.oereb` using a bounding box (envelope):
735+
736+
https://api3.geo.admin.ch/rest/services/api/MapServer/identify?geometry=2599000,1200000,2604000,1203000&geometryType=esriGeometryEnvelope&layers=all:ch.astra.baulinien-nationalstrassen_v2_0.oereb&mapExtent=2480000,1070000,2840000,1310000&imageDisplay=3600,2400,96&tolerance=0&geometryFormat=interlis&sr=2056

0 commit comments

Comments
 (0)