In this Year the FME Desktop bringt the new API for Raster using Python. Its possible to make any actions, for example: create a mosaic, make Clipper, extract informations Bounding Box from Raster file, remove Band, etc...
Inside FME Core has transformer to do theses actions, but if you are a Pythonics like me :) you can create scripts language in Python.
I created a Workspace that demonstrate a just Clipper using only Python Script.
The source data is a Raster file and the transformer AttributeCreator is configurated parameter the Bounding Box informations : XMin,yMin,XMax and yMax.
Continuing we have the transformer PythonCaller. A PythonCode was written to receive the information Bounding Box and make a just simple Clipper action.
The class responsible to performs a clipper on raster file is FMERasterTools.
Has a important documentation online to understand better the use API for Raster File:
https://docs.safe.com/fme/html/FME_Objects_Python_API/index.html
I entered below the Python Code with comments:
How you can see above, on the line 17 I check the geometry source data if is a Raster file ( if tipo == 512 ). If the transformer PythonCaller receive another geometry instead Raster file, the information will be show in Attribute tipo ( line 28 ).
And the line 23 the action Clipper was configurated with simple line code:
Now, everybody can program use the API for Raster using Python. Access the documentation and play with Python and transformers. :)
If anyone has any doubt, please contact me that i will help.
See you the next Post.
Nenhum comentário:
Postar um comentário