Question

Tester on a filename_part

  • 2 April 2013
  • 5 replies
  • 2 views

This one has me stumped so I'm hoping there is an easy answer.

 

 

I have:-

 

(1) 1x index Shapefile containing tiles representing geoTiff images with attribute LOCATION = "myTile1.tif", LOCATION = "myTile2.tif" etc.

 

(2) 1x of the mentioned geoTiff image files

 

 

In my workflow, I have a simple "FilenamePartExtractor" to get the geoTiff filename e.g. _filename_part = "myTile2.tif" (2) + the Index Shapefile (1) both feeding into a "Tester".

 

 

In the Tester I have Left Value = "LOCATION", Operator = "=", Right Value = "_filename_part"

 

 

When I run it, nothing passes the Tester. If I subs for the actual value i.e. Right Value = "myTile2.tif" the correct feature is matched and passed on.

 

 

Eventually, I want to use this workspace in a batch process to recursing through all the geoTiff files in a folder so I don't want "hard-code" the value as described. Is there anything I am doing wrong/mis-understanding by testing for RightValue = "_filepart_name"??

 

 

Any help or advice much apreciated,

 

Jason

 

 


5 replies

Userlevel 4
Badge +13
Hi,

 

 

Have you had a look at the raster reader? 

 

 

Userlevel 4
Hi,

 

 

try connecting a Logger just before the Tester and see what values you get. Feel free to post a copy-paste from the log here. That'll make it a lot easier for us. 

 

 

David
Badge +10
The RasterReader is definately the way to go with this kind of issue. You can use some string manipulation transformers to build the file path of the raster image you need and you can do this dynamically, you then pass that string into the RasterReader to only red the raster image(s) you need. It makes for a very flexible workspace.
Hi,

 

Thanks for the replies and pointing me to RasterReader, I guess this would mean I don't have to write a batch script (to run the fmw again all *.tiff) and everything is run within FME.

 

 

But, in principle, my original setup as described (logically) should work. Using a Logger before and after the Tester, Before: _filename_part = "myTile2.tif", After: _filename_part = "".

 

 

I actually resorted to using VariableSetter and VariableRetriever to store the _filename_part - but if someone can explain why that attribute is "lost" going through the Tester, I'd like to understand. In the Tester Help text is states :-

 

 

"Usually the left value is an attribute, the right value is a constant; however, right and left values can be either constants or attributes."
Userlevel 2
Badge +17
Hi,

 

 

I guess you've connected Shape and GeoTiff to Tester separately. Tester transformer cannot compare attributes between different features. If your purpose is to find a tile feature which matches with a GeoTiff at the filename (location) and to give attributes of the matched tile to the GeoTiff, you had better have a look at FeatureMerger instead of Tester.

 

 

Takashi

Reply