Question

Python in FME

  • 7 February 2014
  • 2 replies
  • 0 views

Badge +1
I am trying to work on python script but not able to correctly get what exactly is required. I know how to use it in ArcGIS 10.0 (Xp machine). In ArcGIS, there are two options

 

a) Pre logic script code

 

d = {}

 

def find_duplicates (valX , valY):

 

d[( valX, valY)] = d.setdefault ( ( valX , valY) , -1) +1

 

return d[ ( valX , valY) ]

 

 

b)[Field_name] = 

 

find_duplicates ( [X_Coordina] , [Y_Coordina]

 

 

But here in FME that type of Scripting is not working. Can anyone help me with the same. I used PythonCaller, PythonCreator, but didn't get the expected result. Is it possible to write ArcGIS type of python Scripting in FME?

 


2 replies

Userlevel 2
Badge +17
Hi,

 

 

Definition of "find_duplicates" looks like standard Python code, but the 2nd code maybe is ArcGIS specific style.

 

I think you can achieve your purpose after reading these articles.

 

http://fmepedia.safe.com/articles/How_To/Python-and-FME-Basics

 

http://fmepedia.safe.com/articles/How_To/New-Python-FME-Objects-API-in-FME-2012

 

 

If any question would remain after learning them, let us know again.

 

 

Takashi
Userlevel 2
Badge +17
BTW, it seems that the Matcher and the Counter can do the same thing.

 

If there is not specific reason for using Python script, use Transformers. That's the FME style, I think :-)

Reply