I wanted to create a data extract web service with the following requirements:
- input a polygon
- input a table name correspondnig to a feature class in SDE
- output to any projection
- output to a popular format, maintaining source schemas (Shape file, KML, PDF, GeoPDF, SVG, ESRI Geodatabase, Geo JSON, SWF. See a list of 250+ formats here)
- publish as a web service
The current code we have for a similar application is quite unwieldy, and was created by several programmers using a combination of VB .Net, SQL functions, Perl, and Arc Objects. With FME, we were able to get a workable prototype in about an hour with help from the instructor, Ken Bragg. I think we’ll be seeing a lot more of this high-level programming with diagrams in the future.
Using the FME Workbench, we diagramed a ‘workspace’ that looks like this.
Here are the parameters for the ArcSDE Querier transformer. The SDE_AREA_INTERSECT search method and the Spatial First search order ensure that the query uses an existing spatial index, if available, and that any shapes inside or touching the bounding box will be selected.
Some details about the diagram:
- A Workbench would normally contain a data Reader, but here we don’t need one because Creator is making a dynamic bounding box. (However, we do add SDE under Workspace Resources). The Geometry Source is a 2D Coordinate List, and the Coordinate List is connected to a Published Parameter where a user can input the X,Y coordinates of polygon vertices separated by spaces.
- A first set of AttributeCreator/AttributeSetter transformers creates a blank table attribute, and a Published Parameter is connected to the AttributeSetter
- Connection to SDE is made with an ArcSDEQuerier transformer.
- A second set of AttributeCreator/AttributeSetter combo is used to create a blank fme_feature_type attribute also set to the table name specified by the user.
- Finally there is one dynamic schema Writer. The dynamic schema is used to output all the fields from the source to the destination format.
To turn this into a web service, use the Publish to FME Server tool to create either a Data Download or a Data Streaming service. Data Download creates a link a user can click on, and Data Streaming returns the data directly to the browser.