Skip to main content
Archived

Custom reprojection using Python API

Related products:Integrations

david_r
Evangelist

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 a question with a best answer, an implemented idea, or just a post needing no comment.
If you have a follow-up or related question, 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.

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings