Skip to main content
Question

Find and merge shapefiles(.shp) like YYYY-MM-DD

  • August 8, 2018
  • 7 replies
  • 13 views

hoa_le
Contributor
Forum|alt.badge.img+5

Hi,

I have multiple files with structures (File_YYYY-MM-DD). I want to merge all file the same YYYY-MM-DD into one file. Example: File1_2018-07-01; File2_2018-07-01 merge into File_2018-07-01.

And other files make the same.

How to the way to make it? Can be use Stringrepacer function? Thank you

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.

7 replies

takashi
Celebrity
  • 7842 replies
  • August 8, 2018

I would extract YYYY-MM-DD from the source file name ("fme_feature_type" or "fme_basename") with the StringSearcher, then set the "File_" + <matched result attribute> to the destination feature type name in the writer feature type.

StringSearcher Parameters Example

  • Search In: @Value(fme_feature_type)
  • Contains Regular Expression: \\d{4}-\\d{2}-\\d{2}
  • Matched Result Attribute: _first_match

hoa_le
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 142 replies
  • August 9, 2018

I would extract YYYY-MM-DD from the source file name ("fme_feature_type" or "fme_basename") with the StringSearcher, then set the "File_" + <matched result attribute> to the destination feature type name in the writer feature type.

StringSearcher Parameters Example

  • Search In: @Value(fme_feature_type)
  • Contains Regular Expression: \\d{4}-\\d{2}-\\d{2}
  • Matched Result Attribute: _first_match
Thank you so much. I tried to write .json format, the writer folder can't choose, the dataset have to set filename.json. With the .shp format, it's okie.

takashi
Celebrity
  • 7842 replies
  • August 9, 2018

I would extract YYYY-MM-DD from the source file name ("fme_feature_type" or "fme_basename") with the StringSearcher, then set the "File_" + <matched result attribute> to the destination feature type name in the writer feature type.

StringSearcher Parameters Example

  • Search In: @Value(fme_feature_type)
  • Contains Regular Expression: \\d{4}-\\d{2}-\\d{2}
  • Matched Result Attribute: _first_match
There are two types of Fanout - 'Dataset Fanout' and 'Feature Type Fanout'. Which one can be applied depends on whether the destination format is a file-based one or a folder-based one. Since JSON as destination is a file-based format, you can apply 'Dataset Fanout'.

 

See these links to learn more.

 


hoa_le
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 142 replies
  • August 9, 2018
There are two types of Fanout - 'Dataset Fanout' and 'Feature Type Fanout'. Which one can be applied depends on whether the destination format is a file-based one or a folder-based one. Since JSON as destination is a file-based format, you can apply 'Dataset Fanout'.

 

See these links to learn more.

 

Thank you :)

 


hoa_le
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 142 replies
  • September 19, 2018

Hi,

I have a new question about search filename based on strings.

For example: A folder point that filename as: point1_2018-07-01, point2_2018-09-02,...

An other folder polygon that I will use to spatial join with point. The polygons have filename as: poly_2018-07-01, poly_2018-09-02...The point layer and polygon layer have date time the same in file name.

I want to ask that how to spatial join pair with this point layer with polygon the same date.

Thank you


takashi
Celebrity
  • 7842 replies
  • September 19, 2018

Hi,

I have a new question about search filename based on strings.

For example: A folder point that filename as: point1_2018-07-01, point2_2018-09-02,...

An other folder polygon that I will use to spatial join with point. The polygons have filename as: poly_2018-07-01, poly_2018-09-02...The point layer and polygon layer have date time the same in file name.

I want to ask that how to spatial join pair with this point layer with polygon the same date.

Thank you

Once you have extracted the date part (YYYY-MM-DD) from their file names as an attribute, you can then set it to the Group By parameter of a transformer which you would like to use to perform spatial operations.

 

 


hoa_le
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 142 replies
  • September 20, 2018
Once you have extracted the date part (YYYY-MM-DD) from their file names as an attribute, you can then set it to the Group By parameter of a transformer which you would like to use to perform spatial operations.

 

 

Thank you, I done it :)