Skip to main content
Question

Creating CityGML Solitary Vegetation Object


cossy27
Contributor
Forum|alt.badge.img+2

Hello all, 

I am currently working on the conversion of FBX tree model to CityGML SolitaryVegetationObject. I have made reference to the template workflow for creating SolitaryVegetationObject (ref: https://hub.safe.com/publishers/con-terra-lab/templates/citygml-create-solitaryvegetationobject-with-implicit-representation). However, my case is slightly different from the template. 

First of all, what I current have, is a CSV file containing the tree information (XYZ, DBH, etc) and an FBX file containing one 3D tree model with correct transformation and dimensions (DBH). This FBX file was originally a prototype in FBX format and was transformed into a correct XYZ and DBH. Since not all my data contain crown spread and tree height, they would be estimated by scaling from the prototype with reference to DBH. This estimation would not generate a value for the crown spread and tree height but only a dimension change. What I want to do is to convert this FBX into a CityGML file, appending the attributes from the CSV. The targeted geometry for the GML file is Lod2ImplicitRepresentation according to the OGC CityGML 2.0 standard. I also noticed that writing a Lod2ImplicitRepresentation would require a library, so I created a library in the workflow. Therefore, with reference to the template workflow above mentioned. A workflow is proposed below. 

 

However, this workflow generates no output in GML format. The last output stopped in the GeometryPropertySetter (The last transformer). 

I have also tried to make reference to the workflow of generating a Building CityGML model (ref: https://support.safe.com/hc/en-us/articles/25407401967373-Creating-a-Textured-CityGML-Model). This time, a GML file is output but no geometries were written to the file.

Since I am not so familiar with FME Workbench, I am so puzzled and helpless right now. I would appreciate any kind of assistance very much. 

 

16 replies

max_h
Supporter
Forum|alt.badge.img+10
  • Supporter
  • April 16, 2025

Why did you remove this part?
 

You need to store the x,y,z values so the transformer matrix works.


Otherwise I had sometimes cache problems due to the id setter, so I always had to run it without cache.
 

Have you tried running the provided workspace with the default data? Does it create a gml file then?


cossy27
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 17, 2025

Hello Max. Thanks for your reply!

First of all, the default data did generate a GML file for me. But as I mentioned, my case is slightly different because the tree is already transformed in its source format. The XYZ value already exists in the CSV file so I did not conduct the coordinate extraction. Besides, my tree model does not have the tree height value. The tree height was generated based on the estimation of the original prototype. Therefore, I have tried two approaches, first to remove the transformation matrix and replace some other random field, second to make up a tree height and input as an integer directly into the matrix. Both did not give any output. 


max_h
Supporter
Forum|alt.badge.img+10
  • Supporter
  • April 17, 2025

Then you can simply replace the light green bookmark with a “CityGMLGeometrySetter” and use the x,y,z values in the vertex creator (if you arent already).

If the csv doesnt provide a unique id, you should create one and if it does you should rename it to “gml_id”

 

Did you reduce the trees to 2 or is it stopping the workflow due to an error?

It could be that you have to process your csv a bit more or is it a feature for each point object (tree)?

 

Otherwise it could help when you share excerpts of your data

 


virtualcitymatt
Celebrity
Forum|alt.badge.img+35

It sounds like you’ve already done the work to get your tree models in FBX correct. I’m not really sure how FME will handle the tree model in this case. I suspect that FME wont read the data as you are hoping.

My recommendation would be to make sure that your FBX model looks like you want it to in FME and be sure that the 0,0,0 point of the FBX model is the bottom of the tree trunk. 

The x,y.z in the csv file need to represent the point geometry in FME. 

going into the Feature Merger you want to make sure you have points which are in the correct location.

If you do not want to scale your FBX/Tree model then you can use a citygml_transformation_matrix  which is just the identify matrix. e.g., 

1 0 0 0
0 1 0 0
0 0 1 0

After the SharedItemSetter you should be able to inspect the data in FME and see that all your trees are in the correct location.

This workspace is designed to do what it sounds like you’ve already done for FBX and you want to translate the FBX to CityGML. Again, I’m not really sure if this will work. If you’re able to upload the FBX here I can take a look and see (assuming it’s small)


cossy27
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 17, 2025

Thank you all for replying! I succeeded in converting the FBX tree model to CityGML.

For Max, I reduced the CSV file to two trees just for workflow testing. Thanks for your suggestions! 

For Matt, originally I entered the transformation matrix with reference to the template using XYZ and a pseudo tree height for processing but the dimensions of the tree turned out to be strange. Thanks so much for your advice about the matrix. 

However, I have three questions right now.

  1. The generated GML, no matter for the template GML or my GML, could not pass the validation from github (ref: https://github.com/citygml4j/citygml-tools/releases). The template GML also could not be further converted to CityJSON (while mine were ok).
  2. My GML file looks very strange in GML geometries. Is it the problem of the FBX geometries? Is there any way to fix it? 
CityGML model appearance

 

Original appearance of the model
  1. Although I have attached a CSV, there are no attributes being created in the SolitaryVegetationObject. How could the attributes be appended to the GML file. 

 

I am so sorry for asking so many questions. Your assistance actually helps me out very much. 


max_h
Supporter
Forum|alt.badge.img+10
  • Supporter
  • April 17, 2025

It should be enough to add them in your feature writer properties under “user attributes”, the writer should then add those attributes to your gml properties.

 

Are both odd looking trees on the same coordinate or are the locations correct?
The model looks fine, it’s the texture that’s messed up. Try it with one tree, then we know if it gets confused by the id-setter.

 

 


cossy27
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 22, 2025

Hello Max, thanks for your reply!

I don’t think it is about the id because I only import one FBX model each time when I run the workbench. But sure I should check if the tree coordinates match the appearance coordinates.


cossy27
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 23, 2025

I have some findings regarding the texture. I have only one PNG as texture and my model has two parts, one is the crown and another is the trunk. The <app:X3DMaterial> part referenced to both parts of the model separately while the <app:ParameterizedTexture> part only referenced to one part of the model, leading to an incomplete texture. Is there any cause to this problem and is there any way to fix it?

 


max_h
Supporter
Forum|alt.badge.img+10
  • Supporter
  • April 23, 2025

As you’re not touching the texture, it is only about the reader/writer and your original modell.

Sometimes fme data inspector shows a bit more like transparent planes, so maybe try a different viewer or see how it looks implemented in cesium or whatever you’re using for your city modell.

 

Are your trees otherwise correct by now or do you still need help regarding translation?


cossy27
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 24, 2025

Hello Max, thanks for your reply. 

The tree model conversion is ok. The remaining issue is the texture. I followed the inspector on each step in FME. I could not observe any problem during the process. The texture has been attached to the model until the final output. 


max_h
Supporter
Forum|alt.badge.img+10
  • Supporter
  • April 24, 2025

Yeah, as I guessed as you didnt touch the texture.
So the issue is either your viewer or the original data.
Try your workspace with a different fbx modell ( FBX Trees ) and check your gml in other viewers.

Then you can conclude the issue


cossy27
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 28, 2025

Hello Max, thanks for your advice!

I did try one FBX tree model from the link you provided. The result turned out to be fine. The texture was not lost. So the problem should be my source FBX model?

 


max_h
Supporter
Forum|alt.badge.img+10
  • Supporter
  • April 28, 2025
cossy27 wrote:

Hello Max, thanks for your advice!

I did try one FBX tree model from the link you provided. The result turned out to be fine. The texture was not lost. So the problem should be my source FBX model?

 

At least it seems to be the most likely cause.


cossy27
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 28, 2025

I think I have found some possible reasons for the texture loss. My tree models were separated into two sections, crown and trunk. And I found that only the crown had an image texture. The trunk was only a RGB base color for the material of the trunk. I think it causes the texture loss but I am not sure how to fix it.


max_h
Supporter
Forum|alt.badge.img+10
  • Supporter
  • April 28, 2025

Top of my head you got two choices: either work on your model (e.g. set a simple brown texture on the trunk with something like blender) or try setting the images of every part with appearance setter.

 

But without having the model I cant help you in detail, maybe others have better ideas, so I guess it’s best to close this thread and ask in your other one as we derailed a bit from your opening question.

 

Good luck though!


cossy27
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • April 29, 2025

Hello Max, thank you very much for your continuous assistance and reply to my issue.

Further discussions will be continued in another post of mine. Thanks!

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings