Solved

Merging feature types but retaining the original feature type description as an attribute

  • 8 October 2019
  • 2 replies
  • 8 views

Badge +1

I am trying to read some Ordnance Survey data (Vector Map District) in SHP format, this is delivered as a separate ZIP file for every tile, for example; SH, SJ & SN. Each file contains a number of feature types that 'should' be the same but, for example, if there are no 'glasshouses' in the SN area then that feature type will not be included in the SN file. A secondary issue is that whilst each zip file contains similar feature types they are named uniquely, for example, the Buildings feature type will be named SH_Buildings, SJ_Buildings and SN_Buildings respectively.

Whilst the feature types are unlikely to change very often I would prefer to create a dynamic workspace that can handle changes should they occur.

My initial attempt has been to use the Merge Feature Type option in the reader to bring all the feature types into a single type. Unfortunately this does not retain the original feature type description which I would like to use in a filter further along in the processing. I've tried exposing the fme_feature_type attribute but following the merge this just contains the merged feature type description.

Does anybody know of a way to dynamically read a potentially varying number of feature types but then also retain the original (pre-merge) feature type descriptions for use elsewhere in the workspace?

Many thanks

icon

Best answer by ebygomm 8 October 2019, 13:24

View original

2 replies

Userlevel 1
Badge +21

"My initial attempt has been to use the Merge Feature Type option in the reader to bring all the feature types into a single type. Unfortunately this does not retain the original feature type description which I would like to use in a filter further along in the processing."

 

This doesn't seem correct, if selecting Merge Feature Type you should get a single reader on the canvas which automatically has the fme_feature_type format attribute exposed, this should then contain the relevant feature type for each feature

e.g.

Badge +1

Hi egomm, many thanks for this. I've just carried out some further tests and it does look like the feature types are coming through but they still have the SH_ prefixes which is why they weren't being picked up by my attribute filter. I've just added another step to amend the value of the fme_feature_type attribute to remove the first 3 characters, this now normalises the the feature types, for example, 'SH_Buildings', 'SJ_Buildings' and 'SN_Buildings' feature types become just 'Buildings' which is now being picked up by my filter and processed correctly.

Sometimes you just need somebody to say that it should be working to trigger some more testing!

Reply