Your SlideShare is downloading. ×
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Beyond 49x Transformers: Don't be afraid of (the) Python!
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Beyond 49x Transformers: Don't be afraid of (the) Python!

583

Published on

This session gives a short introduction for the usage of Python scripts in FME Desktop processes. First it will be demonstrated how to compute buildings’ roof heights at certain ground points with the …

This session gives a short introduction for the usage of Python scripts in FME Desktop processes. First it will be demonstrated how to compute buildings’ roof heights at certain ground points with the PythonCaller and an external Python package. The second demo shows how to persist the FME logfile and the runtime statistics into a central database via Python shutdown script for all those who do not have a FME Server at hand (for now).
See more presentations and videos at: www.safe.com/fmeuc

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
583
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. CONNECT. TRANSFORM. AUTOMATE. Beyond 49x Transformers: Don't be afraid of (the) Python! Tino Miegel Software Engineer
  • 2. Introduction !  Employed at con terra GmbH since 2009 !  Spatial ETL Professional Services !  FME Certified Trainer since 2010 !  FME Certified Professional since 2013 CONNECT. TRANSFORM. AUTOMATE.
  • 3. What is Python? Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed. Source: https://www.python.org/doc/essays/blurb/
  • 4. What is Python? !  Interpreted language !  With dynamic typing !  Extensive standard library !  Available without charge for all major platforms !  Freely distributable Included in every FME Desktop and FME Server
  • 5. Why use Python? !  Easy to learn !  Very „googlable“ !  Thousands of additional libraries available !  Fast !  Comprehensive usage e.g. !  Esri ArcGIS !  Blender
  • 6. Hello World in Python #HelloWorld.py print("Hello World!") >>> Hello World! >>>
  • 7. Where to find Python in FME !  Startup and Shutdown Python Script " Navigator -> Workspace Parameters -> Advanced
  • 8. Demo 1 – Log Statistics Live Demo !  Use a Shutdown Python Script to log statistic information into a central file or database !  Access several FME runtime variables via the fme module:  import  fme    runtime  =  fme.elapsedRunTime    >>>    12.3  
  • 9. Where to find Python in FME !  PythonCreator and PythonCaller transformers " QuickAdd or Transformer Gallery
  • 10. Demo 2 – Handle Dynamic Attributes !  Handle features with an arbitrary number of attributes !  Leave features with a defined attribute set !  Name !  ID !  Create Attribute Container Features for each attribute with !  referenceFID !  AttributName !  AttributValue Live Demo
  • 11. Where to find Python in FME !  Scripted Python Parameter !  Navigator -> User Parameters -> Private Parameters !  Has to end with a return statement
  • 12. Change Default Interpreter !  Python Options (Custom Interpreter) " Tools -> FME Options -> Runtime !  Why? !  Need other python version <2.7 !  Utilize external python packages from a different interpreter, e.g. arcpy
  • 13. Order of Evaluation 1.  Scripted Python Parameter 2.  Startup Python Script 3.  Workspace logic 1.  Reader 2.  Transformer chain 3.  Writer 4.  Shutdown Python Script
  • 14. Advanced Usage - FMEObjects !  Make sure to select „Install FME SDK“ on installation of FME !  API documentation !  <FMEHOME>fmeobjects pythonapidoc
  • 15. Demo 3: WorkspaceRunner !  Use the Python WorkspaceRunner interface to run your FME workspaces: !  run(workspace)   !  withParameters(workspace, parameters) !  promptRun(workspace) Live Demo
  • 16. Advanced Usage – Plugin SDK !  Code your own native transformer with Python !  API documentation !  <FMEHOME>pluginbuilderpythonapidoc !  Sample (available in FME 2015 Beta builds) !  <FMEHOME>pluginbuildersamplespython
  • 17. Thank You! !  Questions? !  For more information: !  Tino Miegel, t.miegel@conterra.de @TMiegel !  con terra GmbH, fme@conterra.de !  Python and FME Basics http://fmepedia.safe.com/articles/How_To/Python- and-FME-Basics CONNECT. TRANSFORM. AUTOMATE.

×