Skip to main content
Solved

Writing empty shapefiles

  • November 25, 2021
  • 3 replies
  • 155 views

I receive an empty shapefile from our client and if I don't add any features, have to rename it.

Since FME is feature based it won't write to a new shapefile if empty.

 

The shapefile can also not contain a null feature so the NoFeatureTester or a null Creator is not an option.

I'm currently on FME version 2019.2.1

 

How can I write empty shapefiles?

Best answer by ebygomm

I think if the empty shapefile already exists, you can use a FileCopyWriter to rename it

View original
Did this help you find an answer to your question?

3 replies

ebygomm
Influencer
Forum|alt.badge.img+38
  • Influencer
  • Best Answer
  • November 25, 2021

I think if the empty shapefile already exists, you can use a FileCopyWriter to rename it


geomancer
Evangelist
Forum|alt.badge.img+48
  • Evangelist
  • November 25, 2021

You can also create an empty shapefile by passing a feature with no geometry and no attributes. See the lowest branch in the illustration below.

FME Hub contains several transformers that can test for the absence of features.

QGIS will open this shapefile, as will FME Data Inspector (but with a warning).

Create_empty_shapefile_workflow


  • Author
  • November 26, 2021
ebygomm wrote:

I think if the empty shapefile already exists, you can use a FileCopyWriter to rename it

The filecopy writer did the trick indeed, using the NoFeaturesTester I check for empty shapefiles and if so, copy the base to my results folder.imageGood to know: the filecopy_source_dataset & filecopy_dest_filename have to be set using an attributecreator


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings