Skip to main content

I have point feature with duplicated and sometimes tripiclated or more. But for each point we may have the attributes with different values. My goal is to have only a unique point, but keep all the attributes. So I used the Matcher (with generate list enabled) and then ListConcatenator connected to SingleMatched output. It's work perfectly, I have now only single unique points and I setup the counter option, so I know how many points this single point represents. If I click in one point in the inspector a can see all the attributes and expand the nested list. I have up to 6 list for some points. What I want to achieve is to be able to export the point to feature class and keep all the nested attributes from the list. Is that possible? Will be like expose the nested list.

Thanks in advance,

Dilson

@dilsonkitoko

You can't put a list in a attribute as you are aware of.

Your options are then either put the concatenated data structured in a string and store in a attribute (listconcatenator etc.)

Or separate the list from the geometry.

Keep the id of the features with the geometry.

Explode the list and save it in some tabular form to your (or your used software liking)

Then the data is always accessible through the key (the ID).

Like a spatial database actually.


Hi @gio

Thanks for your answer, I was thinking that was possible to do something like explained in this documentation. Or just expose it to use the attribute creator. But maybe is my version, I'm using FME 2014 SP https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_Transformers/!List_Attributes/Understanding-List-Attributes.htm

Yes, I tougth about concatenate also. So, I will try to explode and work just with the separeted table.

Kind Regards


You don't mention which format you are writing to. But it is very unlikely that a format will support a list in the same way as FME, unless it supports a hierarchy like XML. So how does your format/software handle a feature with multiple values?

Like @gio says, you can either concatenate the values into one string, or you can write all of your values to a separate table and create a join with a foreign key. 


Or, you could create new attributes for each value. For example, say I have a point that represents a forest. In that forest I want to record the types of tree, which are oak, maple, and pine. So I have:

Mylist{0}.TreeType= oak
Mylist{1}.TreeType= maple
Mylist{2}.TreeType= pine

What you could do is rename them to multiple attributes, so you have:

TreeType1 = oak
TreeType2 = maple
TreeType3 = pine

That would be another way of handling this. You could either use a plain AttributeRenamer, or you could create a loop in a custom transformer (using ListElementCounter to find how many times you need to loop, and a ListIndexer to extract the attributes).

If it is an XML based format, then let us know as it might be possible to create several records per feature I think.


In some cases, the BulkAttributeRenamer (Action: Regular Expression Replace) could be used to convert individual elements of a structured list attribute to non-list attributes effectively. If you exposed list elements in a prior transformer, the BulkAttriuteRenamer would expose destination attribute names automatically.


using a attributerenamer or listpopulator to create attribute for each related object is akin to adding the suggested table in to the feature structure.

This might lead to objects/features with a lot of missing or Null attributes. Or features with large amount of attributes. (like a forest with a lot of tree types)


Dear All, @gio @MarkAtSafe @takashi

Thank you very much for all your inputs, it's helped me a lot to clarify the question.

I achieved close to what I was looking for using the Matcher / List Exploder and then Aggregator. The same result could be achivied using ListConcatenator I end up concatenating the attributes. I've also tested what was suggested by @takashi and its also works by exposing the attributes and renaming, which was my initial wayforward. But it may lead me to have too many attributes. Because some points only have one subtype, but other may have up to 5 subtypes.

Sorry for not mentioning with precision the format. I'm writing to a point feature class to an Esri FGDB

Kind Regards,


Dear All, @gio @MarkAtSafe @takashi

Thank you very much for all your inputs, it's helped me a lot to clarify the question.

I achieved close to what I was looking for using the Matcher / List Exploder and then Aggregator. The same result could be achivied using ListConcatenator I end up concatenating the attributes. I've also tested what was suggested by @takashi and its also works by exposing the attributes and renaming, which was my initial wayforward. But it may lead me to have too many attributes. Because some points only have one subtype, but other may have up to 5 subtypes.

Sorry for not mentioning with precision the format. I'm writing to a point feature class to an Esri FGDB

Kind Regards,


You don't mention which format you are writing to. But it is very unlikely that a format will support a list in the same way as FME, unless it supports a hierarchy like XML. So how does your format/software handle a feature with multiple values?

Like @gio says, you can either concatenate the values into one string, or you can write all of your values to a separate table and create a join with a foreign key. 


Or, you could create new attributes for each value. For example, say I have a point that represents a forest. In that forest I want to record the types of tree, which are oak, maple, and pine. So I have:

Mylist{0}.TreeType= oak
Mylist{1}.TreeType= maple
Mylist{2}.TreeType= pine

What you could do is rename them to multiple attributes, so you have:

TreeType1 = oak
TreeType2 = maple
TreeType3 = pine

That would be another way of handling this. You could either use a plain AttributeRenamer, or you could create a loop in a custom transformer (using ListElementCounter to find how many times you need to loop, and a ListIndexer to extract the attributes).

If it is an XML based format, then let us know as it might be possible to create several records per feature I think.

fyi I created a custom transformer to do the conversion mentioned (from mylist{0}.Tree, etc to Tree0, Tree1, Tree2, etc). You can find it online on the hub: https://hub.safe.com/transformers/listbreaker - it does need FME2019 though, because of a new function I needed to use.

 


Reply