Let me get you through one paragraph of background before we get to the fun stuff: In an earlier video I included an example of capturing a spatial constraint from the active ArcGIS Pro map or scene and sending it into an ETL workspace. The sample happened to be working with a WFS service; these have a bounding box parameter that can constrain the features retrieved. WFS services also support more complex spatial operators which can be used with arbitrary geometry operands supplied as GML fragments. However, unless you know how to put all the required XML together for WFS requests then you'll be like me and terrified of attempting it. ArcGIS Pro 2.3 itself only supports a bounding box constraint on WFS services.
Spatial constraints are a lot easier with feature services. This blog will show you how easy.
Core geoprocessing has supported feature services as input parameters for several releases now, why bother using Spatial ETL against feature services anyway? Well, if your feature service is heading out the door as some other format, or you are using some transformations indicating Data Interoperability, or your feature service is very large and you don't want to use selections to subset it. I just helped one customer who needed to dynamically handle a spatial constraint mid-ETL with a FeatureReader transformer (more on that below). There are many use cases.
Data Interoperability is all about code-free approaches, but I'll take a wee diversion into feature service REST API query parameters so you understand what goes on. Below is a screen shot of the HTML view of a feature service Query endpoint. Note there is an Input Geometry parameter (supplied as JSON) and you can set how it is used, in my case it is a Polygon for which I want only features satisfying the constraint Intersects.
So, the trick with applying spatial constraints to feature services is just supplying the geometry!
In the blog download (Pro 2.3+) you'll find the sample tool used, but the approach is very simple, just apply it yourself in your own models. Click to enlarge this graphic to see the map I used, the feature set in the map and table of contents and the model run as a tool. The feature set is driving the analysis geometry automatically.
The tool being used is the Model named SpatiallyConstrainedGP which has an input parameter of type Feature Set. At run time you supply a value by choosing a layer or feature class or creating a feature manually by editing in the map.
SpatiallyConstrainedGP wraps the ETL tool SpatiallyConstrainedETL like this, there is a model tool Calculate Value between the input feature set and the ETL tool:
All that is happening with Calculate Value is the input feature set is turned into a JSON string with a Python snippet:
The JSON is then supplied to the published ETL tool parameter Input Geometry (remember the Query endpoint!) and...
...the ETL tool does its stuff, considering only features intersecting my feature set...
..which is to make a spreadsheet summarizing some parcel area totals per case of an attribute:
So that's it, just grab JSON from the map when you need to supply a feature service reader with an Input Geometry parameter. if you are using a FeatureReader transformer to read a feature service the workflow is a little different, you'll need to convert the JSON into an actual FME feature with a GeometryReplacer (the geometry encoding is Esri JSON) and supply it as the initiator Spatial Filter constraint of the FeatureReader, like this:
Now you can apply map-driven spatial constraints to your ETL!