DefaultCRS vs OtherCRS

You have the choice - really!

Have you ever wondered if it is possible to download the features in a different coordinate system than the default?

Have you also tried to change the coordinate system in FME's user interface, but without success?

Then you should first check the capabilities of your WFS and look there for the supported coordinate systems.

For demonstration purposes we will again have a look at the cadastral parcel service of North Rhine-Westphalia, we've seen in chapter GetCapabilities.

https://www.wfs.nrw.de/geobasis/wfs_nw_inspire-flurstuecke_alkis?SERVICE=WFS&REQUEST=GetCapabilities&VERSION=2.0.0

Please open the GetCapabilities-URL in a browser and search for the Feature Type of your interest, e.g. CadastralParcel.

<wfs:FeatureType>
<wfs:Name>cp:CadastralParcel</wfs:Name>
<wfs:Title>Flurstück</wfs:Title>
<wfs:Abstract>
Gebiete, die anhand des Liegenschaftskatasters oder gleichwertiger Verzeichnisse bestimmt werden.
</wfs:Abstract>
<ows:Keywords>
<ows:Keyword>Flurstück</ows:Keyword>
<ows:Keyword>Cadastral Parcel</ows:Keyword>
</ows:Keywords>
<wfs:DefaultCRS>urn:ogc:def:crs:EPSG::25832</wfs:DefaultCRS>
<wfs:OtherCRS>http://www.opengis.net/def/crs/EPSG/0/25832</wfs:OtherCRS>
<wfs:OtherCRS>http://www.opengis.net/def/crs/EPSG/0/25833</wfs:OtherCRS>
<wfs:OtherCRS>http://www.opengis.net/def/crs/EPSG/0/3034</wfs:OtherCRS>
<wfs:OtherCRS>http://www.opengis.net/def/crs/EPSG/0/3857</wfs:OtherCRS>
<wfs:OtherCRS>http://www.opengis.net/def/crs/EPSG/0/4258</wfs:OtherCRS>
<wfs:OtherCRS>http://www.opengis.net/def/crs/EPSG/0/4326</wfs:OtherCRS>
<wfs:OtherCRS>http://www.opengis.net/def/crs/EPSG/0/900913</wfs:OtherCRS>
<wfs:OtherCRS>urn:ogc:def:crs:EPSG::25833</wfs:OtherCRS>
<wfs:OtherCRS>urn:ogc:def:crs:EPSG::3034</wfs:OtherCRS>
<wfs:OtherCRS>urn:ogc:def:crs:EPSG::3857</wfs:OtherCRS>
<wfs:OtherCRS>urn:ogc:def:crs:EPSG::4258</wfs:OtherCRS>
<wfs:OtherCRS>urn:ogc:def:crs:EPSG::4326</wfs:OtherCRS>
<wfs:OtherCRS>urn:ogc:def:crs:EPSG::900913</wfs:OtherCRS>
<ows:WGS84BoundingBox>
<ows:LowerCorner>5.60719400147395 50.2373512078443</ows:LowerCorner>
<ows:UpperCorner>9.59059953291114 52.6005473870064</ows:UpperCorner>
</ows:WGS84BoundingBox>
<wfs:MetadataURL xlink:type="simple" xlink:href="https://apps.geoportal.nrw.de/soapServices/CSWStartup?Service=CSW&Request=GetRecordById&Version=2.0.2&outputSchema=http://www.isotc211.org/2005/gmd&elementSetName=full&id=af87d424-64e9-4d2d-9dd1-b3bd80423209"/>
</wfs:FeatureType>

As you can see, there is excatly one default coordinate reference system, aka DefaultCRS, of course.

In this case, there are 6 alternative coordinate reference systems listed in OtherCRS.

Why 6, I count 13 OtherCRSes?

If you take a closer look, you'll recognize two different notations

  1. http://www.opengis.net/def/crs/EPSG/0/*

  2. urn:ogc:def:crs:EPSG::*

According to the WFS 1.1.0 specification (see chapter "9.2 Request") even three notations are allowed.

Let's quote the specification:

The optional srsName attribute of the <Query> element is used to specify a specific
WFS-supported SRS to be used for returned feature geometries.

Its value may be the <DefaultSRS> or any of the <OtherSRS> values listed for the
feature type in WFS capabilities document.
If no srsName value is supplied, then the features shall be returned using the
advertised <DefaultSRS> value.

Any valid URI value can be assigned to the srsName attribute.
However, in order to enhance interoperability, a web feature service must be able 
to process srsName attribute values with the following format models:
• EPSG:<EPSG code>
• http://www.opengis.net/gml/srs/epsg.xml#<EPSG code>
• urn:EPSG:geographicCRC:<epsg code>

In these format models, the values <EPSG code> are placeholders for actual EPSG 
code values.

The specification refers to format models (not notations).

Ok, let's dive into practice.

Parameter
Value

WFS URL

Version

2.0.0

Feature Types

CadastralParcel

Max Features

1

Leave empty the [Coord. System] ...

... run the Workspace and inspect the result.

As you can see, the coordinate system is EPSG:25832, which is the DefaultCRS.

Next go to Translation Log and search for the <WFS GetFeature URL>:

http://www.wfs.nrw.de:80/geobasis/wfs_nw_inspire-flurstuecke_alkis?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=cp%3ACadastralParcel&NAMESPACES=xmlns%28cp%2Chttp%3A%2F%2Finspire.ec.europa.eu%2Fschemas%2Fcp%2F4.0%29&OUTPUTFORMAT=application%2Fgml%2Bxml%3B%20version%3D3.2&COUNT=1

If you look the URL for "25832", you will not find it!

This means, that

  1. the Get Feature request does not contain a coordinate system and

  2. therefore the features are returned in DefaultCRS, in this case EPSG:25832

Next edit the reader parameters (right click) and set the coordinate system to EPSG:4326, wich is listed as OtherCRS, see capabilities above.

Run the Workbench again and inspect the result.

Mmh, this looks strange!

To understand what happens under the hood, fetch the <WFS GetFeature URL> from the Translation Log again.

http://www.wfs.nrw.de:80/geobasis/wfs_nw_inspire-flurstuecke_alkis?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=cp%3ACadastralParcel&NAMESPACES=xmlns%28cp%2Chttp%3A%2F%2Finspire.ec.europa.eu%2Fschemas%2Fcp%2F4.0%29&OUTPUTFORMAT=application%2Fgml%2Bxml%3B%20version%3D3.2&COUNT=1

Compare this URL with the URL above.

Doing this, you'll recognize three things:

  1. the Get Feature request does not contain any coordinate system like EPSG:4326 and

  2. therefore the features are returned in DefaultCRS, in this case EPSG:25832.

  3. Both URLs are absolutely identical!

What is the conclusion?

If you define a coordinate system in the user interface,

this coordinate system will NOT be integrated into the request!

The only thing that happens is, that FME displays an EPSG:25832-feature in EPSG:4326.

This is the reason for the distorted visual representation.

And what now?

Remember the specification:

The optional srsName attribute of the <Query> element is used to specify a specific
WFS-supported SRS to be used for returned feature geometries.

The optional srsName for OtherCRSes is part of the <Query> element and therefore part of the request URL!

Q: Adding a srsName attribute to the request URL? How do I do that?

A: Take it literally!

Just append "srsName=<any CRS string from the capabilities>&" behind the question mark of the WFS-URL.

https://www.wfs.nrw.de/geobasis/wfs_nw_inspire-flurstuecke_alkis?srsName=urn:ogc:def:crs:EPSG::4326&

Important note: You must end the URL with an Ampersand "&"!

Finally, the following note: If you are working with Spatial Operators which are containing coordinate system definitions as part of the filter expression AND you want to fetch the features in an OtherCRS, you have to specifiy the coordinate system twice:

  1. as part of the Filter Expression and

  2. as part of the GetFeature-Request as discussed in this chapter.

I have not studied the specification for this detail, but in my experience both CRSes must be identical.

Some WFS only understand the Spatial Filter, if the CRS is defined in Default.

Last updated