Skip to main content
Solved

Get reader extents in parameters and use them in writer

  • August 12, 2020
  • 2 replies
  • 129 views

dhaulagiri
Contributor
Forum|alt.badge.img+4

Hello,

I am new to FME. I want to load multiple shapefiles into Oracle spatial tables. I just have a problem with the extents. I would like to get them from shapefiles and use them as parameter in the Oracle writer but I don't know how to do it.

I know the BoundsExtractor transformer but I don't know how to store xmin, xmax, ymin and ymax values as parameters, even more with multiple shapefiles.

Thanks for your help!

Best answer by markatsafe

To get the extents of all your SHAPE data you can use the BoundingBoxAccumulator transformer.

 

As for the spatial extents, unfortunately, these can only be set from a Parameter on the Orace Spatial Writer Feature Type (which must be set before the workspace runs) and cannot be set from an attribute value derived during the workspace run.

 

I think the best approach might be to alter the user_sdo_geom_metadata after you have written the data. That should be possible - see the Oracle Spatial docs. To do this use the FeatureWriter to write you Oracle data, and then connect a SQLExecutor to send the SQL to alter the user_sdo_geom_metadata table.

 

The alternative is to have a two part workflow, read the shape data to get the extents using BoundingBoxAccumulator and then use WorkspaceRunner to call the workspace that loads your data (and sets the extents parameters).

 

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.

2 replies

Forum|alt.badge.img+2
  • Best Answer
  • August 12, 2020

To get the extents of all your SHAPE data you can use the BoundingBoxAccumulator transformer.

 

As for the spatial extents, unfortunately, these can only be set from a Parameter on the Orace Spatial Writer Feature Type (which must be set before the workspace runs) and cannot be set from an attribute value derived during the workspace run.

 

I think the best approach might be to alter the user_sdo_geom_metadata after you have written the data. That should be possible - see the Oracle Spatial docs. To do this use the FeatureWriter to write you Oracle data, and then connect a SQLExecutor to send the SQL to alter the user_sdo_geom_metadata table.

 

The alternative is to have a two part workflow, read the shape data to get the extents using BoundingBoxAccumulator and then use WorkspaceRunner to call the workspace that loads your data (and sets the extents parameters).

 


geomancer
Evangelist
Forum|alt.badge.img+60
  • Evangelist
  • November 18, 2020

In this post I give some SQL commands to write the spatial extents of the table to the user_sdo_geom_metadata table.