Skip to main content

Hi

I have a csv file with the name of an electricity pole and the oblique images where the pole is visible on.

Now I want to pull these images from a folder with a large collection of images containing the images I want and copy them to the folder with the csv.

 

I dont know how to import a folder or a path.

I have seen them but cant seem to find in the readers...

 

I don't know how to copy.

 

Please be elaborate with the explanation, because that's something I never have done with FME.

 

If all you want to do is copy, this would be the workflow:

Read the CSV file.

If needed create attributes from the CSV for the full path of the source and destination.

Use the FileCopy writer to copy the files.

You should not open the images to copy (or move) the files.

Hope this helps.


I think I found a solution.

 

This works for 1 CSV file.

As I have like 100 folders with each one CSV I was hoping this would work:

But I get this error:

 

 

 

 


If all you want to do is copy, this would be the workflow:

Read the CSV file.

If needed create attributes from the CSV for the full path of the source and destination.

Use the FileCopy writer to copy the files.

You should not open the images to copy (or move) the files.

Hope this helps.

You can read the multiple CSV files in one attempt by using wildcards in the CSV reader.

Like c:\\temp\\**\\*.csv will read all csv files in subfolders of c:\\temp.

No need for the PATH reader.


You can read the multiple CSV files in one attempt by using wildcards in the CSV reader.

Like c:\\temp\\**\\*.csv will read all csv files in subfolders of c:\\temp.

No need for the PATH reader.

I don't understand.

I use the path reader to make an attribute 'files' that contains the path + filename so the file copy writer knows which files I want to copy...

 


I don't understand.

I use the path reader to make an attribute 'files' that contains the path + filename so the file copy writer knows which files I want to copy...

 

Is the image file name not the contents of the CSV file?


Is the image file name not the contents of the CSV file?

I'll explain

 

So I have a cad file with electricity poles. I have shapefiles (in this case 2) with the footprints of aerial images. So everything within a footprint polygon is visible on the corresponding image. The footprints contain the image name, not the path where they are stored.

I have a workbench that converts the cad file to a shapefile an makes an attribute for the pole name.

Then I have a workbench that makes a csv file using the pole name as file name.

They also fanout to subfolders with the pole name. So I have a folder of every pole that contains a csv file with the pole name.

I used a spatial filer on the poles and footprints so that all the images on which the pole is visible are stored in the csv.

 

Now I'm trying to make the workbench to automaticaly copy the images from a big collection of images in the corresponding folder and that is the same folder as where the csv file is.

What I have works if I use one csv file, but I want it to look up all the csv files in a folder and run the workbench per csv file....

 

Hope this helps.

 


I'll explain

 

So I have a cad file with electricity poles. I have shapefiles (in this case 2) with the footprints of aerial images. So everything within a footprint polygon is visible on the corresponding image. The footprints contain the image name, not the path where they are stored.

I have a workbench that converts the cad file to a shapefile an makes an attribute for the pole name.

Then I have a workbench that makes a csv file using the pole name as file name.

They also fanout to subfolders with the pole name. So I have a folder of every pole that contains a csv file with the pole name.

I used a spatial filer on the poles and footprints so that all the images on which the pole is visible are stored in the csv.

 

Now I'm trying to make the workbench to automaticaly copy the images from a big collection of images in the corresponding folder and that is the same folder as where the csv file is.

What I have works if I use one csv file, but I want it to look up all the csv files in a folder and run the workbench per csv file....

 

Hope this helps.

 

If this works for one csv file, you could also use this:

Create a second workspace (I usually call it Runner) with:

Directory and File Path reader to select all CSV files in the selected folders (but only the file names), followed by:

A WorkspaceRunner transformer to call the current workspace per CSV file (should be a published parameter). Use the path_windows attribute to pass the csv file name to the current workspace to loop over all csv files.


If this works for one csv file, you could also use this:

Create a second workspace (I usually call it Runner) with:

Directory and File Path reader to select all CSV files in the selected folders (but only the file names), followed by:

A WorkspaceRunner transformer to call the current workspace per CSV file (should be a published parameter). Use the path_windows attribute to pass the csv file name to the current workspace to loop over all csv files.

I tried this

 

It doesn't give any errors, but it doesnt copy anything...

 

 

I added the path reader and selected the master folder. In the parameters I selected recurse into subfolders.

When i inspect this the path_windows it has the folder and the csv file.

I only want the csv file so I made a tester that only keeps the csv files.

So the workspace runner only gets the correct path_windows.

This is my setup for the workspace runner

 

Also, when I press run it asks me for a folder. I select the master folder containing the subfolders with the csv files.

 


I tried this

 

It doesn't give any errors, but it doesnt copy anything...

 

 

I added the path reader and selected the master folder. In the parameters I selected recurse into subfolders.

When i inspect this the path_windows it has the folder and the csv file.

I only want the csv file so I made a tester that only keeps the csv files.

So the workspace runner only gets the correct path_windows.

This is my setup for the workspace runner

 

Also, when I press run it asks me for a folder. I select the master folder containing the subfolders with the csv files.

 

@koenvdw I am sure this can work. If you could upload the workspace (no data) or send it to me at I will have a look.


I think I found a solution.

 

This works for 1 CSV file.

As I have like 100 folders with each one CSV I was hoping this would work:

But I get this error:

 

 

 

 

I solved the error above by adding the pole name to the csv. That's the same attribute used to make the sub directories. Then I had to add a stringreplacer behind the Filenamepartextractor.

I replaced the ** with the name of poles/directories.

The the filecopy writer could find the right path to write to.


Reply