Last week was the 2019 Esri Partner Conference followed by Developer Summit, events at which we enjoy being challenged by friends from around the world who are using ArcGIS in their work, and also other apps and formats that ArcGIS does not make or manage.
One partner from Europe asked how to use GML (Geography Markup Language) files in ArcGIS Pro. This format is really a category of formats; the underlying XML - as a markup language intends - can be extended, usually to push a data schema down into the protocol. He had in mind however what we know as Simple Feature GML, which makes the task - well - simpler, but that isn't critical to this discussion.
In ArcMap, Data Interoperability extension may be used to both directly read GML files (of the simple feature profile, recognized from a .gml filename extension, even without licensing Data Interoperability extension) or to make an interoperability connection to any supported GML profile, such as the complex INSPIRE themes. This workflow is not implemented in Pro, partly because WFS services (which are usually GML "in motion") are the most common use case for GML and are natively supported in Pro, and partly because interoperability connections are being re-imagined for a future release of Pro.
In ArcGIS Pro, Data Interoperability extension can also be used to convert GML files just like in ArcMap - with the Quick Import geoprocessing tool, or with a Spatial ETL tool, but the partner thought asking everyone to license an extension would be a hurdle.
I decided to blog about an implementation pattern that does what was asked for - convert GML to geodatabase features within ArcGIS Pro - but that can also be used to convert any of the hundreds of formats and connections accessible to ArcGIS Data Interoperability. The GML data originator has access to ArcGIS Enterprise with Data Interoperability extension so the pattern leverages that, but end users with GML files only need ArcGIS Pro and authenticated access to a geoprocessing service. You can use this pattern to stand up any format conversion you wish at any scale - but I hasten to add it must be a free or cost-recovery-only service if you make it public.
Enough talk, how do we do this? We're going to use ArcMap and Pro in a double act. Why both? At time of writing ArcGIS Pro cannot publish web tools containing Spatial ETL tools, so we'll use ArcMap for that step.
In the blog download below you'll find a 10.6.1 version toolbox which contains these tools (click any images to enlarge them):
GML2FGDB is a Spatial ETL tool that converts one or more files of any schema of simple feature GML to a file geodatabase named GML2FGDB.gdb (with overwrite!). It looks like this if edited:
If you run it as a tool you can see it has a parameter exposed for GML geometry axis order that defaults to 1,2. If your data is in Y,X order you can set 2,1. 3D data is supported by the 1,2,3 and 2,1,3 values.
GML2FGDBModel is a model tool that incorprates the script tool ZipGDB to compress the file geodatabase to zip file. The compression step is necessary because geoprocessing services do not support workspaces (i.e. geodatabases) as output parameters.
GML2FGDBModel is shared as a geoprocessing service (make it synchronous) which I called GML2FGDBService:
Lastly, the model tool GML2FGDBService wraps the service and adds the script tool UnZIPGDB for the round trip from a local GML file or files, to the web service that does the translation without requiring Data Interoperability locally, then finally unzips the scratch ZIP file containing a scratch geodatabase into a user-selected destination directory.
Now GML2FGDBService can be freely used in Pro:
GML2FGDBService will always output a file geodatabase named scratch.gdb to your output directory, so be careful not to overwrite prior output!
Now anyone with access to the model tool and service can convert suitable GML files (or any other data if you refactor the Spatial ETL component) to local geodatabase using ArcGIS Pro. Enjoy!