Question

SHP file data downloaded from an API is in folder, how can I expand it out?

  • 25 August 2022
  • 4 replies
  • 14 views

Badge

I have connected to an API to download data to create an automatic process. The data covers the whole UK so comes group by region in folders, but I can not figure out how to expand these folder to have the remaining SHP files inside for clipping and symbolising etc. Im sure there is a tool for this I am probbaly unaware off. (See image)

image


4 replies

Userlevel 1
Badge +11

Hi @edward_skanska​,

Try the Directory and File Pathnames reader followed by a FeatureReader. The directory and file pathnames reader is a neat format that lets you specify that you want to look for a particular file only. You can set it to the parent folder and then *.shp to look for the shape files (and even have it check for subfolders by enabling 'Recurse into Subfolders'). As long as the sidecar files are in the same directory, FME should be able to pick those up as well on read. Then the FeatureReader can point at the attribute holding the individual dataset paths afterwards to read the files in. Hope that helps!

Badge

Hi @edward_skanska​,

Try the Directory and File Pathnames reader followed by a FeatureReader. The directory and file pathnames reader is a neat format that lets you specify that you want to look for a particular file only. You can set it to the parent folder and then *.shp to look for the shape files (and even have it check for subfolders by enabling 'Recurse into Subfolders'). As long as the sidecar files are in the same directory, FME should be able to pick those up as well on read. Then the FeatureReader can point at the attribute holding the individual dataset paths afterwards to read the files in. Hope that helps!

Hello!

Okay I will give this a try. This is probably another easy question but when placing the reader in my system it asks for the folder of file pathname as since its from an API i cant figure out how to set up this link so it reads the data from the correct place

image

Userlevel 1
Badge +11

Hello!

Okay I will give this a try. This is probably another easy question but when placing the reader in my system it asks for the folder of file pathname as since its from an API i cant figure out how to set up this link so it reads the data from the correct place

image

Hi @edward_skanska​, my apologies for the confusion, I had misinterpreted your question the first time around, please scratch the Directory and File Pathnames idea.

 

Do the URLs in your screenshot go to the individual folders by region and do they contain multiple shapefiles? Consider adding a second HTTPCaller pointing at the url attribute as the request, followed by a FeatureReader to read in the actual file instead. Other more HTTPCaller-savy folks may have better ideas as well.

Badge

Hello!

Okay I will give this a try. This is probably another easy question but when placing the reader in my system it asks for the folder of file pathname as since its from an API i cant figure out how to set up this link so it reads the data from the correct place

image

Hi there

 

The URL's contain multiple shapefile. Using the HTTPcaller I have been able to download 56 BIN files from these 56 links. I feel like it may have combined the multple shp features togeather in these BIN files. So im going to try and figure out now how to expand these or convert these files.

 

Thank you for the help!

Reply