Question

Create cityGML file from polygonz data

  • 24 February 2023
  • 7 replies
  • 16 views

Dear community,

 

I would like to create a cityGML file from a db, which structure I don´t know. I have found a table, where building parts like in the picture are saved as polygonz, but I can´t aggregate them into one solid.

 

Grafikfenster_2geometryThe _geometry field I got from an GeometryExtractor, because there was no possibility to see the geometry attribute in the FeatureReader.

 

Is it possible to aggregate those faces into one solid?

 

 


7 replies

Userlevel 2
Badge +17

Hi @greyfox​,

If the polygons have a building id on them, the process I would recommend is:

  • FaceReplacer to convert the polygons to faces
  • Aggregator to group the faces into multi-surfaces. Set group-by to building id.
  • If you need Solids instead of multi-surfaces, you can use the SolidBuilder instead of the Aggregator. It can be picky about gaps in your building, though.
  • Use the CityGMLGeometrySetter to add the required CityGML role and LOD settings

 

Thank you for your answer. The Polygons doesn´t have any building id. Every polygon has an oid, but with no information to which building it belongs.

 

BuildingpartPicture 

Tabelle 

I have to say, that the db is used by a software, where the schema seems to be implemented. in pgadmin i can see over 2.7k tables, but in FME there are only a few. In this software you can select a region by a bbox and export the data. I would like to try this by the FME, but it is possible without knowing the "right" schema?

Userlevel 2
Badge +17

Thank you for your answer. The Polygons doesn´t have any building id. Every polygon has an oid, but with no information to which building it belongs.

 

BuildingpartPicture 

Tabelle 

I have to say, that the db is used by a software, where the schema seems to be implemented. in pgadmin i can see over 2.7k tables, but in FME there are only a few. In this software you can select a region by a bbox and export the data. I would like to try this by the FME, but it is possible without knowing the "right" schema?

Hi @greyfox​,

Are you using the PostGIS or PostGRES reader to read the database? The PostGRES reader should give you access to more of the non-spatial tables in the database. It's possible that there is a table to map polygon ids to buildings.

If not, I have had some success in the past using the NetworkTopologyCalculator to separate the building polygons:

  • GeometryCoercer to convert the polygons to lines
  • Chopper to chop lines into 2 point segments
  • NetworkTopologyCalculator to figure out which lines connect to each other
  • DuplicateRemover to keep only one segment for each polygon id
  • FeatureMerger to merge network id on copy of original polygons by polygon id - this becomes the building id
  • FaceReplacer and Aggregator as above, grouped by network id.

Hello daveatsafe,

 

thank you for your answer.

 

I´ ve found a table with the meanid/meanname, where the building parts like Walls, Roofs, Closure and Ground surfaces have been saved. With the featureJoiner i´ve joined those attributes and could filter the building parts.

 

Workflow 

Filter:

 

TesterFiltern 

Unfortunetly I didn´t know which Options I should choose for the CityGMLGeometrySetter

 

GeometrySetter_WelcheEinstellungen 

Output:

 

Gebäude 

But unfortunetly there are no gml:id´s

 

Inspector 

Userlevel 2
Badge +17

Hello daveatsafe,

 

thank you for your answer.

 

I´ ve found a table with the meanid/meanname, where the building parts like Walls, Roofs, Closure and Ground surfaces have been saved. With the featureJoiner i´ve joined those attributes and could filter the building parts.

 

Workflow 

Filter:

 

TesterFiltern 

Unfortunetly I didn´t know which Options I should choose for the CityGMLGeometrySetter

 

GeometrySetter_WelcheEinstellungen 

Output:

 

Gebäude 

But unfortunetly there are no gml:id´s

 

Inspector 

The building components (Wall, Roof, Ground) should have their CityGML Lod Name set to lod2MultiSurface and Feature Role set to consistsOfBuildinPart. This will make them children of Buildings.

However, you will also need to create the Building parent features. There should be one for each building, but they require no geometry. Instead of the CityGMLGeometrySetter, use an AttributeCreator to create the attribute citygml_feature_role and set it to cityObjectMember.

You should also create the attribute gml_id on the buildings, either with an AttributeCreator or UUIDGenerator. This gml_id will also need to transferred to the building component features as their gml_parent_id, perhaps with FeatureMergers.

Proper matching of the building gml_ids and component gml_parent_ids will ensure that the feature hierarchy is correct on the output CityGML files.

Hello dave,

 

should I create the Building features with the Creator? Sorry for those noob questions.

 

GetDataFromDB 

I get the data by a FeatureReader. PostGIS for geometry and PostgreSQL for "non-geometric" data, because I cant see them in the Reader using the PostGIS reader.

 

 

After this I pass all the geometries to a UUIDGenerator and filter them (Ground,Closure,Roof and Wall)

ExtractPartsMy problem here is first to understand how all those loose parts can be assigned to a building without other informations.

 

 

 

 

 

 

 

Userlevel 2
Badge +17

Hello dave,

 

should I create the Building features with the Creator? Sorry for those noob questions.

 

GetDataFromDB 

I get the data by a FeatureReader. PostGIS for geometry and PostgreSQL for "non-geometric" data, because I cant see them in the Reader using the PostGIS reader.

 

 

After this I pass all the geometries to a UUIDGenerator and filter them (Ground,Closure,Roof and Wall)

ExtractPartsMy problem here is first to understand how all those loose parts can be assigned to a building without other informations.

 

 

 

 

 

 

 

It would be very helpful to see the features you are working with. You can create a template from the workspace that includes the feature caches using the following process:

  • Open and run the workspace to populate the feature caches
  • File - Save as Template
  • Check the Files to Add - Include Feature Caches box
  • Click OK to save

If you do not want to share the template publicly, you can email it directly to me: dave.campanas@safe.com. I will be able to open the template and see the features at each step.

Reply