As part of a configuration validation process I need to check if the list of coordinate system options retrieved from an external list are defined in the instance of FME running the validation workbench. This validation process needs to work with both inbuilt and custom projections that have been defined. My configuration list is based on the FME name of the projection (i.e. for custom projections, matching the attribute COORDINATE_SYSTEM_DEF). Is there a way to read all currently defined coordinate systems to check if the items in the list exist?
Solved
FME Reader to retrieve all defined coordinate systems
Best answer by daveatsafe
Hi @jstanger,
Please use a PythonCaller, with the following code:
import fme
import fmeobjects
def testCoordsys(feature):
testCoordsys = feature.getCoordSys()
coordsysManager = fmeobjects.FMECoordSysManager()
allCoordsys = coordsysManager.getCoordSysList()
if testCoordsys in allCoordsys:
feature.setAttribute('_valid_coordsys', 'yes')
else:
feature.setAttribute('_valid_coordsys', 'no')
In the PythonCaller, you will need to expose the new _valid_coordsys attribute to make it visible to Workbench.
After the PythonCaller, you can use a Tester to route the features based on the value of _valid_coordsys.
Reply
Rich Text Editor, editor1
Editor toolbars
Press ALT 0 for help
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.