Hi,
I'm not sure I understand your attribute: how can the value of "citygml_feature_role" be both "a" and "b" at the same time? What type of attribute is "citygml_feature_role? Is it a string? A list? Something else?
If "citygml_feature_role" is a string, look into the "Contains" operator. If it is a list, consider a ListSearcher rather than a Tester/TestFilter.
David
In the attribute "citygml_feature_role" I need to know if "consistsOfBuildingPart" exists or not. If yes I need to do some manipulation on the other attributes where the "citygml_feature_role" has the both values "consistsOfBuildingPart" and "cityObjectMember". Otherwise I just need to do the manipulation where the "citygml_feature_role" is "cityObjectMember".
Thank you!
Mani
Hi,
those attribute values look like different features, am I right? The Tester/TestFilter is only able to test values within the same feature, not across several features, as seems to be the case here.
If you need to test values across several features, you need to modify your approach. On possible solution might be to use an AttributeCreator with "Multiple feature attribute support".
Another solution could be to sort your features so that those containing key values come first and then use VariableSetters/Retrievers accordingly.
David
Thank you David.
I tried to work with attributecreator but it still does not work. What did I do wrongly?
Best regards,
Mani
and u need another tester for
featurer-1].etc != consistofetc. and featurer-2].etc ! cityObjectetc.
unless there are indeed only those 2 possibilities.
Then u need to set the other value for the test attribute in the "Else" part.
(maybe contains is ok...does "=" equal a contain?)
Hi Gio,
It does not make any differences. I have only <missing> in the "test" attribute.
I dont know how your data is structured, so it is hard to give advice.
(the bit you show seems not ordered?)
Its an citygml you read? Or is it a citygml extract in a txt or csv format?
You can use xquery or so on it?
maybe post a bit of it? if its not too large..
Sorry. I replied actually before your second post.
I applied your suggestion and Now I have something strange:
I am reading a CityGML file. As I already said I need to apply two different processes dependent on if I have buildingpart (shown by consistOfBuildingPart) or not (then I just have cityObjectMember).
for example in this case I have building part. But I might have also a case which does not have any building Part. So I have to consider both conditions
Thanks
Buildingpart is a child of OBjectMemeber.
Outcome of your sript is logical.
You lookback 1, and 2 records.
If you read in the xml as a text, then the first row wil something else then "consistOfBuildingPart" or "ityObjectMember" , wich leads it to set test to 10 ( above the topmost boundedBy there probably is another value..).
Condition one does not exist, so it wil be never met (in the piece u posted). If you have the enitre xml nest in textlines, then the start of the object might meet those conditions..
I think you need to read the order of the file differently or use a different technique.
If yuo have the xml, try the querier to read it in, then the xml nesting will be flattened to attributes. Making your query easier to perform.
I read it directly in FME with CityGML format. Do you recommend me not to read it as CityGML?
Hi Mani,
Let's clarify your requirement.
We can see about 20 features in the table you posted.
Each feature has an attribute named "citygml_feature_role", and the attribute can store one of "consistsOfBuildingPart", "cityObjectMember", or "boundedBy".
I guess that your requirement is:
-----
If both "consistsOfBuildingPart" and "cityObjectMember" have occurred, all the 20 features should go to the "A" process,
If "cityObjectMember" has occurred but "consistsOfBuildingPart" has NOT occurred, all the 20 features should go to the "B" process.
-----
Is my understanding correct?
If not, please explain your requirement clearly.
Takashi
Hi Takashi,
The second paragraph should be edited in the way that:
"" If both "consistsOfBuildingPart" and "cityObjectMember" have occurred, the 3 features should go to the "A" process (means only those feature which have both "consistsOfBuildingPart" and "cityObjectMember"),
If "cityObjectMember" has occurred but "consistsOfBuildingPart" has NOT occurred, only those features which has the value "cityObjectMember" should go to the "B" process.
I do not care about other feature roles like bounded by and so.
To give you a better idea:
In this example I just have one building but there might be cases that I have lots of building some have BuildingPart and some not. Then I should separate them for the process. where they have building part I should apply a process working on "consistsOfBuildingPart" and "cityObjectMember". But where I have only Building another process should be applied. The reason is in these two different case other attributes will be different. Look at this example:
Here I h ave two different buildings one with building part and other only one building. This can be distinguished by checking the gml_id and gml_parent_id. So the yellow color shows the building with two building parts and in this case only the features which have "citygml_feature_role=consistsOfBuildinPart" have e.g. "citygml_function". But where I only have a building without any part (here no color) then this feature itself will have "citygml_function". That is why I need to separate them and apply two different process.
Regards,
Mani
Perhaps the requirement is like this?
-----
For a "cityObjectMember" feature (Member) whose "gml_id" is
X (e.g. "b_186965" in the sample),
- If there are "consistsOfBuildingPart" features (Parts) having
X as "gml_parent_id", the Member and the Parts should go to the "A" process,
- If there is NOT "consistsOfBuildiingPart" features having
X as "gml_parent_id", the Member shoud go to the "B" process,
- Other features such as "boundedBy" will be discarded.
Yes. Exactly.
I also was thinking of using "AttributeFilter" based on "cityObjectMember" and "consistsOfBuildingPart". Then use a "FeatureMerger" to check whether gml_parent_id of "consistsOfBuildingPart" as Requestor matches with gml_id of Member then use merged and referenced feature and if not using unreferenced. It does not work at all in this way (no match)
I think as Gio and David mentioned because I have multi-feature here and they are not flattened I cannot check them together. But as far as I have to use CityGML reader I do not know how to solve the problem!
I got it. A possible way is:
1) Divide the features into Members and Parts accoding to "citygml_feature_role" with a TestFilter (discard other features).
2) Send the Members to the Requestor port, the Parts to the Supplier port of a FeatureMerger. You can divide them into 1) Members having Parts, 2) Members not having Parts, and 3) Parts having parent Member, by comparing "gml_id" of Members and "gml_parent_id" of Parts.
Join On: Requestor gml_id = Supplier gml_parent_id
Process Duplicate Suppliers: Yes
Example
Thank you Takashi. I somehow did the same but did not check process duplicate into yes. was it the problem?
No, I do not think so.
Even if you set "No" to the parameter, the Requestors can be divided into the Merged port and the NotMerged port as expected. But in that case, referenced suppliers go to not only the Referenced port but also the DuplicateSupplier port. You will have to collect referenced suppliers from both ports.
Thank You Takashi, Gio and David for your useful tips and idea