2

We have a directory with over 300 aerial photos of our town. Every photo has an unique name. Using an georeferenced Esri shapefile of a specific area we want to copy the photos that are coverd by the shapefile to another directory.

We want to merge these photos to one single photo after the first process automatically.

Is this possible with FME?

1

Sure possible.

Selecting the overlapping tiles: Multiple ways to do this, but one is: Use a FeatureReader to read the "selection polygon". Send it to another FeatureReader to read the grid, set Spatial Filter to "Initiator Intersects Result". You could also use a SpatialFilter to do this.

Copying the overlapping rasters: Also multiple ways to do this. I would use a FeatureReader with the "Directory and File Pathnames" format to scan the folder with rasters. Then use a FeatureMerger to merge the result of the previous action to the features. Merged is inside the "selection polygon". Then use a FeatureWriter with the "File Copy" format to copy the images to a new location. As an alternative you can use a SystemCaller to do it like you would do commandline.

Merging the rasters: Read the rasters. If not georeferenced, use a RasterGeoreferencer to put the rasters on coordinates. Then use a RasterMosaiker to merge them into one. FeatureWriter to write the result.

Pro tips:

  • Use a small dataset when developing the workspace to keep the iteration time low. Rasters can be time and memory consuming.
  • Baby steps. Add a Transformer, run the workspace. When it works, next step. If it does not, tinker on. Otherwise it is hard to isolate the issue.

Update 201907310646: Added a printscreen of a raw workflow to clarify. As I have no data I can't work it out in more detail. If you supply a sample set I can.

My assumption is you have the following inputs:

  • A shapefile with a selection polygon.
  • A shapefile with the grid of the images, which has unique filenames corresponding with the rasterfiles.
  • A set of rasterfiles. (If not georeferenced, some steps need to be added.)

Supply feedback if my assumptions are wrong or if this doesn't work out for you.

enter image description here

  • Hello Niels, What other parameters should i add to the FeatureReader? It does not seem to extract the potos to be selected. – Erik_Zuidplas Jul 30 at 13:43
  • Hello Niels, I used a shapefile with squares containing the names of the poto's. Then i used an shapefile containing the are i am interestted in. Then in FME i used AreaOnAreaOverlayer to cut out the area of interest. The Tester extracted 4 parts i need. What other parameters should i add to the FeatureReader? It does not seem to extract the potos that i need. – Erik_Zuidplas Jul 30 at 13:50
  • Can we assume that the photos are georeferenced and in the same coordinate system as the shapefile data? Otherwise the FeatureReader won't work. – Mark Ireland Jul 30 at 14:41
  • When you have the result, you can use the featuremerger to merge the clipped features with the rasterfilelocations from the directoryreader. You can then feed the merged result in another featurereader to read the rasterfiles. (Now off to the kitchen and offline for a bit...) – nielsgerrits Jul 30 at 15:30
  • Apparently the feature reader that reads the directory with the raster wants to load all the rasters in its memory. This is a problem, we are short of memory. That is why i would like the selection polygon to select only the 4 rasters that i need. Why does it need to scan the folder instead of using the filename provided by the shape to find the needed 4 files? The scanning process of 300+ files (800mb each) takes very long and uses a lot of memory. – Erik_Zuidplas Aug 5 at 11:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.