FME_MacroValues['COORDSYS'] If the parameter is of the type Choice with Alias, how do I get a hold of the alias in Python syntax?
To get hold of a parameters value in Python, you can easaly use ex.
Page 1 / 1
I'm afraid the alias is not accessible in python. At the moment it's only a gui element in the workspace and not really a true parameter. We can look into making that available - would you mind just explaining why you want to get at it?
Thanks
Ken
Hi Ken!
I'm using python to create a small file which logs all the choices made in a data download service, eg the public parameters. The file is to accompany the rest of the data to the end user. Because of that I don’t want them to get the espg code, but the name of the coordinate system.Maybe there is another way to solve my problem?
Thanks Kicki,
Yes I can see why you want to do that now. Currently there is no easy way to get at the alias values and I have filed a request to look at making the aliases available in a workspace.
I thought of one way to do this but I'm not sure I'd recommend it. It would be a bit of work to set up, has the potential to really slow down your workspace and seems kind of brittle. But if you really really want to get at the alias values you could try it.
The FME Server REST services can return the parameter and alias valuses in XML or JSON if you send the URL below (replace host, repository and workspace with your own and change .xml to .json if you want json):
http://host/fmerest/repositories/Repository/Workpsace/parameters.xml
In your python script you could use urllib2 to request this page and then parse the response. You'd need to authenticate or use a token if you have security enabled for the REST Service. There is an example of accessing the REST service in a shut down python script here you could use as a starting point - though in this case it's doing something completely different:
http://fmepedia.safe.com/articles/How_To/Notify-an-FME-Server-Topic-on-Success-or-Failure-of-a-Workspace
Hope this helps,
Ken
I havea workspace that takes 3 different csvs and imports to a separate featureclass within the same file geodatabase. The csvs are loaded independently so the user makes the choice. I would like to get access to the alias because I use the value part to define which feature type to use (csv reader) and the alias I wanted to use for the name of an AGS map service which gets created within the shutdown script.
I've created a new custom transformer that helps you to expose all the "Choice with Alias" published parameters in a workspace. It's available on the FME Hub here:
https://hub.safe.com/transformers/choicewithaliasparamfetcher