Skip to main content
Solved

Writing empty shapefiles

  • November 25, 2021
  • 3 replies
  • 181 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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

ebygomm
Influencer
Forum|alt.badge.img+46
  • 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+60
  • 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

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