# Outlook: WFS 3.0

If you want/have to deal with **WFS version 3.0** also known as **OGC API – Features**, please forget eveything you ever learned about **XML Filter Expressions**!

<mark style="color:red;">**Important note: You can NOT use XML Filter Expressions in order to query a WFS 3.0! That's technically impossible.**</mark>

Normally, this chapter should end here, because filtering an API Features WFS needs a different approach.

But as WFS 3.0 is becoming more and more popular, I'll give you some hints, how to use WFS 3.0 with FME.

First of all, you'll need a service URL like this:

```url
https://ogc-api.nrw.de/lika
```

Please copy and paste this URL into a web browser!

The first difference is, that you'll see a GetCapabilities-like document, which is human readable (by default) and not an XML.

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FpDGrKq8blGVzATAyZML4%2Fwfs_036.png?alt=media&#x26;token=0b35415d-2da4-4580-a3af-54235813a925" alt=""><figcaption><p>"Capabilities" of WFS 3.0</p></figcaption></figure>

Beneath "***Ressources***" please click the first link in order to show the **Collections**.

```
Please note: Collections are the most important concept of WFS 3.0.
```

According to the specification (chpt. 4.1.4) a **feature collection** or **collection** is a set of features from a dataset.

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FxLOMbgyVCT9kVT4uJO9Z%2Fwfs_038.png?alt=media&#x26;token=675cd943-c7f3-49ea-a133-e52828165705" alt="" width="534"><figcaption><p>Collections-Link</p></figcaption></figure>

**Collections** are presented the same way.

You'll see a (human readable) list of feature types (sets), the service provides, e.g.

* Flurstück
* Flurstückspunkt
* Gebäude, Bauwerk
* Katasterbezirk
* Nutzung
* Nutzung-Flurstück
* Verwaltungseinheit

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FhTKfPxLQyJAS2uylpLqY%2Fwfs_037.png?alt=media&#x26;token=a10a3114-b983-4324-8a2d-66189339e1b3" alt=""><figcaption></figcaption></figure>

Next, you may click on a feature type (set), let's say "[Flurstück](https://ogc-api.nrw.de/lika/v1/collections/flurstueck/items)", which opens a graphical preview of both

1. Geometry
2. Attributes

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2Fu0xuQfgMYAOdPgbYRfrm%2Fwfs_039.png?alt=media&#x26;token=19f3d094-625f-40bd-a1df-e09db00c6072" alt=""><figcaption></figcaption></figure>

Is this relevant for working with WFS 3.0 in FME?

To be honest: not really!

But another thing is really important working with FME: the URL

```url
https://ogc-api.nrw.de/lika/v1/collections/flurstueck/items
```

If you modify the URL the following way

```url
https://ogc-api.nrw.de/lika/v1/collections/flurstueck/queryables
```

i.e. by replacing "***items***" with "*<mark style="background-color:green;">**queryables**</mark>*", you'll get a list of attributes you can use for filtering.

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FAxZOnlMSdaeIcUFCeALI%2Fwfs_040.png?alt=media&#x26;token=274483c0-5056-46f5-89c0-858dc456ffdb" alt=""><figcaption></figcaption></figure>

So, let's try it!

| Key                                          | Value                                    |
| -------------------------------------------- | ---------------------------------------- |
| OGC API URL                                  | <https://ogc-api.nrw.de/lika>            |
| *<mark style="color:orange;">Version</mark>* | *<mark style="color:orange;">3.0</mark>* |
| Collections                                  | flurstueck (cadastral parcel)            |
| Queryables                                   | flstkennz                                |

First, we need a different reader: **OGC API - Features (WFS 3.0)**

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FfQBBhmymg50RWOpuUWyo%2Fwfs_043.png?alt=media&#x26;token=33fb8739-fca1-46de-868e-3eb957d95ec0" alt=""><figcaption><p>OGC API - Features (WFS 3.0) Reader</p></figcaption></figure>

Next open **\[Parameters ...]** as usual.

Expand **\[Constraints]** and click **\[...]** to select a collection.

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FfEELyrRPswXoIoOU2poK%2Fwfs_048.png?alt=media&#x26;token=ce47f636-546f-4d23-a7bb-3e052276392c" alt=""><figcaption></figcaption></figure>

Please note: if you just want to see a few features for inspecting, you can limit to number of features to read in reader parameters.

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FVpNc6Ggm7iEjoBbDHKFB%2Fwfs_044.png?alt=media&#x26;token=38c7cef5-02f1-4d23-be92-d156f5c93357" alt=""><figcaption></figcaption></figure>

Run the reader and examine the features.

## Comparison Operators

As mentioned before, it is not necessary/possible to write XML Filter Expressions to do attributive queries.

You can define queries via the user interface. Just expand **\[Constraints]**, **\[Collection Query Parameters]**.

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FLqnyKz9wbd5vESOAHEDR%2Fwfs_045.png?alt=media&#x26;token=80efa42b-4b63-496d-bfc1-c3b85f53ccfe" alt=""><figcaption><p>Collection Query Parameters</p></figcaption></figure>

In \[**Collection(s)]** you can choose the collections, you've choosen above.

In \[**Parameters]** you'll see default parameters predefined by the OGC specification, but unfortunately no service specific parameters, i.e. attributes.

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2Fp0olFpQkvEye5tIbnyqs%2Fwfs_046.png?alt=media&#x26;token=5b7d6cdd-e582-4ccd-a7c8-89bd6c077506" alt=""><figcaption><p>OGC default parameters</p></figcaption></figure>

But remember the <mark style="background-color:green;">**Queryables-URL**</mark>, which shows a list of attributes you can use for filtering.

You can use **any attribute from the Queryables-List** as **Parameter Name**, in this case "**flstkennz**".

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FD0k7mIGG4PesiptmtDxK%2Fwfs_041.png?alt=media&#x26;token=93fafecf-b6c9-42c7-8754-498808f7c487" alt=""><figcaption></figcaption></figure>

Tadaa! You know where we are?

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FwtgyqEZzR0s2tdYioycR%2Fwfs_042.png?alt=media&#x26;token=a0e5352c-bd0d-46db-b951-91df011ea8c7" alt=""><figcaption></figcaption></figure>

And of course, you can **process a list** as discussed in [bulk-processing](https://olivers-expression-lab.gitbook.io/filter-expressions-in-fme/bulk-processing "mention") by using the **FeatureReader**-Transformer.

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FSJiA4Wjh7r2qKjqbpBLn%2Fwfs_047.png?alt=media&#x26;token=f2e236b5-621b-4b91-990f-137cdc00e4c8" alt=""><figcaption></figcaption></figure>

## Spatial Operator: BBOX

As discussed in [#bbox](https://olivers-expression-lab.gitbook.io/filter-expressions-in-fme/spatial-operators#bbox "mention"), the bounding box is the swiss army knife of all spatial filters, because you can request a BBOX from the server and do the spatial operation locally in FME subsequently.

Also remember the predefined **\[Collection Query Parameters]** we have seen above, especially

* **bbox**
* **bbox-crs** (**C**oordinate **R**eference **S**ystem)

If your service comes in WGS84 (EPSG:4326) as default coordinate system, it is sufficient to pass a **comma seperated coordinate list** to the service (see [spec](https://docs.ogc.org/is/17-069r3/17-069r3.html#_parameter_bbox)):

1. lower left X,
2. lower left Y,
3. upper right X,
4. upper right Y

If the default coordinate system ist **not WGS84**, you have to define the coordinate system of your bbox coordinates in **\[bbox-crs].**

<mark style="color:red;">**Important note:**</mark> <mark style="color:red;"></mark><mark style="color:red;">you have to use the coordinate string provided by</mark> <mark style="color:red;"></mark><mark style="color:red;">**your**</mark> <mark style="color:red;"></mark><mark style="color:red;">service!</mark>

I.e. you can not use the string, you normally use in FME, e.g. "EPSG:25832".

<table><thead><tr><th width="431">bbox-crs</th><th>result</th></tr></thead><tbody><tr><td><a href="http://www.opengis.net/def/crs/EPSG/0/25832"><mark style="color:green;">http://www.opengis.net/def/crs/EPSG/0/25832</mark></a></td><td><mark style="color:green;">works</mark></td></tr><tr><td><mark style="color:red;">EPSG:25832</mark></td><td><mark style="color:red;">will not work</mark></td></tr></tbody></table>

To summarize:

<table><thead><tr><th width="306">Parameter Name</th><th>Parameter Value</th></tr></thead><tbody><tr><td>bbox-crs</td><td><a href="http://www.opengis.net/def/crs/EPSG/0/25832">http://www.opengis.net/def/crs/EPSG/0/25832</a></td></tr><tr><td>bbox</td><td>367441,5620100,367619,5620254</td></tr></tbody></table>

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FGH13P3WZjzhGWF2fIKgn%2Fwfs_049.png?alt=media&#x26;token=fbc7b845-ccd5-4e91-b54e-d548295e200b" alt=""><figcaption><p>BBOX Filter in WFS 3.0</p></figcaption></figure>

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2FJS4JCHMpmAPDnoah83PC%2Fwfs_050.png?alt=media&#x26;token=425c32b2-180e-481f-ac13-5e60c9c61313" alt=""><figcaption></figcaption></figure>

Please compare the corresponding result shown in [#bbox](https://olivers-expression-lab.gitbook.io/filter-expressions-in-fme/spatial-operators#bbox "mention")!

Ok, so far the detour to WFS 3.0.

If you want to, you can play around with this:

```url
https://ogc-api.nrw.de/gebref/v1/collections/gebref/
```

```
id: DENW36HK100076NN
```

<figure><img src="https://60501452-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFgBfA6ZqJjyopUS8Ss5Q%2Fuploads%2F3yjhRBIRjccBeGzaj3Q2%2Fwfs_051.png?alt=media&#x26;token=99a32421-b470-47df-a117-0b134e30262f" alt=""><figcaption></figcaption></figure>

**Caution**: please check the coordinates in Inspector ...


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://olivers-expression-lab.gitbook.io/filter-expressions-in-fme/outlook-wfs-3.0.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
