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.
Please open the GetCapabilities-URL in a browser and search for the Feature Type of your interest, e.g. CadastralParcel.
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
http://www.opengis.net/def/crs/EPSG/0/*
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 specification refers to format models (not notations).
Ok, let's dive into practice.
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>:
If you look the URL for "25832", you will not find it!
This means, that
the Get Feature request does not contain a coordinate system and
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.
Compare this URL with the URL above.
Doing this, you'll recognize three things:
the Get Feature request does not contain any coordinate system like EPSG:4326 and
therefore the features are returned in DefaultCRS, in this case EPSG:25832.
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 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.
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:
as part of the Filter Expression and
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