I dug out one of my old FME 2014 workbenches. It has this PythonCaller defining a local CRS. It had worked beautifully for years.
import pyfme
#define custom CRS
myCSMan = pyfme.FMECoordSysManager()
fmeParams = {}
fmeParams['CS_NAME'] = "local_polyconic_cs"
fmeParams['DESC_NM'] = "Dynamic CS"
fmeParams['DT_NAME'] = "WGS84"
fmeParams['PROJ'] = "PLYCN"
fmeParams['UNIT'] = "FOOT"
fmeParams['X_OFF'] = 0.0
fmeParams['Y_OFF'] = 0.0
fmeParams['MAP_SCL'] = 1.0
fmeParams['SCL_RED'] = 0.9996
fmeParams['SOURCE'] = "HESS"
fmeParams['QUAD'] = 1
fmeParams['ZERO_X'] = 0.0001
fmeParams['ZERO_Y'] = 0.0001
surf_lat = float(feature.getAttribute('surf_lat'))
surf_long = float(feature.getAttribute('surf_long'))
fmeParams['PARM1'] = str(surf_long)
fmeParams['ORG_LAT'] = str(surf_lat)
myfmeCS = myCSMan.defineCoordSys(fmeParams, "myfmeCS")
Now I am at FME 2024 where pyfme has been replaced by fmeobjects. So I made the changes like below:
import fmeobjects
myCSMan = fmeobjects.FMECoordSysManager()
…
#defineCoordSys only takes one parameter
myfmeCS = myCSMan.defineCoordSys(fmeParams)
The last line gives this error:
Message Type: fme::internal::_v0::py::Exception
Python Exception <TypeError>: Could not convert Python coord system parameters.
Error encountered while calling method `input'
PythonCaller_5 (PythonFactory): PythonFactory failed to process feature
Any idea?
Allen


