Skip to main content

Hi, I have an issue which could potentially be solved in different ways, and I want to put this out to see if people have better solutions. It is probably best explained with a simple example:

A user requests output of a collection of data - X-points, X-polylines, X-polygons

So we have a list of what they want. The data will be read from three Postgis tables and output dynamically using the Postgis schema to a FGDB. The user will then be sent the FGDB along with one layer file showing the three datasets.

However the geographic area the user has requested data for contains no X-points data, so currently all that is exported is the X-polylines and X-polygons and the layer file contains a broken link for X-points. I am looking for the best way to write an empty X-points feature class to the FGDB so this link remains but isn't broken.

My initial thought is too look at the list the user has requested, then compare it to what is read from Postgis. Then I'd have to create a dummy feature class with a single entry with some sort of text-string flag and write that to the FGDB. I would also need a separate reader to bring in the schema of missing
X-points data set, regardless of the user geographic request area. Then maybe I could use the DatabaseDeleter to delete any entries with this flag?

Am I missing a much simpler solution?

Many thanks

@soothsayers - take a look at the template option in the Writer -

http://docs.safe.com/fme/2018.0/html/FME_Desktop_Documentation/FME_ReadersWriters/geodatabase/GEODATABASE_FILE_writer.htm

I've not got a ESRI license to test with, but I've used this principle for other formats - tell the writer to reference a template file (XML schema document for ESRI) and that should give you the feature classes from the template on your output regardless of whether data exists.


To add to my colleagues suggestion, there's also the chance that a custom transformer might offer you an option to consider. Check out the NoFeaturesTester. This will allow you to identify when no features are found and it generates a single feature to create the FeatureClass. You will then as you say need to consider what to do with this featureclass that now contains the single feature. Hope that helps, Dave


Thank you both very much for your responses. Sadly neither are what I'm after.

Mary, the template option in the writer is not dynamic enough. Should the schema change we are then reading from a dataset which is incorrect. Also this is ultimately going to run on FME Server with no access to an ESRI license.

Dave, as I predicted, the workspace I'm running is much more complex than the example I gave. The NoFeaturesTester could be a useful tool, but not in this example.

Still trying various solutions!


You could consider to use arcpy to generate the missing feature classes. I think the best way to do it, would be to create a custom transformer in which you can give the database name and location, the table name and the attributes (and possibly domains, subtypes, etc) as parameters and use one or more PythonCallers to create the missing featureclasses.

Since you know which classes you have written, you also know which class is missing.

For personal use I have created an Excel-template and an FME Workspace that can generate any Filegeodatabase using PythonCallers and the information given in the Excel-file.


Reply