Skip to main content

I have a WFS that has over 500K features. I want to retrieve just those that intersect my area of interest.

 

If I have a polygon of my AOI and send it to a FeatureReader, with no spatial filter, then I get 30K features (or whatever the Max Features is set to on the WFS connection).

 

If I set the Spatial Filter to Bounding Boxes OGC-Intersect or Initiator OGC-Intersects results, I get the schema, but no actual features.

 

My aoi and the WFS data are in the same projection.

 

If I use a boundsExtractor and HTTPCaller and manually create the call, {redacted}/ows?service=wfs&version=2.0.0&request=GetFeature&typeNames={redacted}&bbox=@Value(_ymin),@Value(_xmin),@Value(_ymax),@Value(_xmax)

 

Then I get just the subset of features I'm interested in.

 

I would much rather use a FeatureReader. What am I missing to get a spatial constraint working?

How is the coordinate system set in the WFS? I was doing a test with a test with a random WFS and found similar results. FME was not able to do the intersection with the bounding box. The logger was reporting this: 

WARN  |No definition was found for coordinate system ` urn:ogc:def:crs:EPSG::4326'
WARN  |<WFS> Unable to reproject LL84 BBOX to ' urn:ogc:def:crs:EPSG::4326', ' urn:ogc:def:crs:EPSG::4326' is not a recognized coordinate system, forcing 'urn:ogc:def:crs:EPSG::4258' instead

 

I guess FME wants to use the WFS coordinate system for the request but doesn't understand it the way it's written. In my case the SRSName in the GetCapabilities is describe like this, which I understand my not be the latest WFS standard, 2.0.2 (http://docs.opengeospatial.org/is/09-025r2/09-025r2.html):

<DefaultCRS> urn:ogc:def:crs:EPSG::4326</DefaultCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::4258</OtherCRS>

 

Anyway, I find the BoundsExtractor + custom request might be the best option. You're sending the request directly to the WFS server, which might be more efficient. If you want you can still use a FeatureReader instead of the HTTPCaller and that way you get the features with their geometries and attributes as if they had already passed through the GML reader


How is the coordinate system set in the WFS? I was doing a test with a test with a random WFS and found similar results. FME was not able to do the intersection with the bounding box. The logger was reporting this: 

WARN  |No definition was found for coordinate system ` urn:ogc:def:crs:EPSG::4326'
WARN  |<WFS> Unable to reproject LL84 BBOX to ' urn:ogc:def:crs:EPSG::4326', ' urn:ogc:def:crs:EPSG::4326' is not a recognized coordinate system, forcing 'urn:ogc:def:crs:EPSG::4258' instead

 

I guess FME wants to use the WFS coordinate system for the request but doesn't understand it the way it's written. In my case the SRSName in the GetCapabilities is describe like this, which I understand my not be the latest WFS standard, 2.0.2 (http://docs.opengeospatial.org/is/09-025r2/09-025r2.html):

<DefaultCRS> urn:ogc:def:crs:EPSG::4326</DefaultCRS>
<OtherCRS>urn:ogc:def:crs:EPSG::4258</OtherCRS>

 

Anyway, I find the BoundsExtractor + custom request might be the best option. You're sending the request directly to the WFS server, which might be more efficient. If you want you can still use a FeatureReader instead of the HTTPCaller and that way you get the features with their geometries and attributes as if they had already passed through the GML reader

The WFS is 2.0.0  and is using EPSG:4326,  same as the feature that is triggering the FeatureReader.    I don't see a similar warning in my log.

 

As for the htmlCaller, it returning a gml in the  _response_body.  If I use a geometryReplacer,  I get an aggregate of all the points, but no corresponding attribute data.  Is there an "in-memory" gml parser, or do I have to write the response to a file and then read it back in (with a featureReader)?


The WFS is 2.0.0 and is using EPSG:4326, same as the feature that is triggering the FeatureReader. I don't see a similar warning in my log.

 

As for the htmlCaller, it returning a gml in the _response_body. If I use a geometryReplacer, I get an aggregate of all the points, but no corresponding attribute data. Is there an "in-memory" gml parser, or do I have to write the response to a file and then read it back in (with a featureReader)?

You can't read an attribute containing a GML, but you can use the HTTP Request from your HTTPCaller as the input from a GML Reader, or a WFS Reader, which is in practical terms the same.

I don't think an HTTPCaller here brings any advantage over using a FeatureReader with the URL as the dataset.


Same problem here, couldn't make it work. Our geoserver has default CRS of EPSG:4326.

Turns out I needed to swap axis order, the old dreadful lat,lon versus lon,lat problem. And of course there's an option for this.

 

Of course, i didn't realise rigth away. I first successfully implemented getFeature-requests with the http caller before realising there might be an option for swapping the axes...

 

Screenshot of how to tweak the axis order in the "parameters" menu of the Feature Reader transformer


Reply