Skip to main content
Archived

Custom reprojection using Python API

Related products:Integrations
  • May 3, 2017
  • 0 replies
  • 20 views

david_r
Celebrity

Sometimes a custom reprojection algorithm that isn't supported by the regular reprojection engine is needed. With the current Python API it is possible to iterate over the feature geometry to recalculate the coordinates, but it can be pretty complex when having to account for all the different geometry types, aggregates, donuts, 2D/3D, arcs etc.

It would be very handy if the Python fmeobjects API could provide for a method (e.g. "performCoordinateFunction") for calling a user-defined function on each coordinate using a callback mechanism.

Example:

def myCoordinateFunction(x, y, z):     x = x + 3     y = y - 3     if z > 100:         z = z * 2     return x, y, z feature = FMEFeature() feature.addCoordinate(55, 81, 233) feature.performCoordinateFunction(myCoordinateFunction) 

After calling the performCoordinateFunction with this sample method the geometry would be situated at (x=58, y=78, z=466). The geometry type and composition should otherwise remain unchanged.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.