Skip to main content

Hi,

I have got citygml files. I need to extract the footprint of each building and the corresponding building id, such as:

<bldg:Building gml:id="_26991">

One building can have more than one footprint.

I'm not very familiar with citygml / fme. Can someone give me a hint how to extract the footprints (which seems quite easy) but additionaly get the building id as well. It seems I need to access the "building" for the id and "footprint" for the footprint. But how do I get building - id for each footprint?

Many Thanks, Rob

Hey Rob,

It's been a while since I dove headfirst into CityGML. Any chance you could include a small example data file?


Have you tried the CityGML reader that ships with FME? That should (assuming the CityGML data is structured properly) do a good job of extracting the information you need.


Hi Kim,

I have attached a file:

ctemp3d-stadtmodell1052-43-3.zip

I looked at the file and it seems all buildings are part of a

<cityObjectMember>

In some cases the <cityObjectMember> contains <groupMember> which then contains the <building>. The ID I'm after is then attached to <cityObjectMember>.

In other cases the <cityObjectMember> contains one <building> and the ID in question is attached to <building>.

Many thanks in advance for any suggestion,

Rob


Thanks for posting the file @rob_f, always makes it easier.

The post of @redgeographics is right in suggesting the CityGML reader, I hope you were using that one already.

If you add a CityGML reader it will ask which featuretypes you want to include. Am I correct in assuming you want the GroundSurface feature? Your example file has 155 of them. Each of these has a gml_parent_id attribute:

  • If it doesn't start with fme_gen it seems to be the id of the building, which is what you wanted.
  • If it starts with fme_gen the parent had no gml_id and FME added one. This seems to indicate the parent is a building without a gml_id. In this case you want the id of its parent groupmember.

I would suggest you also include the Building feature type when adding the reader. You can then test out the cases mentioned above. For the ones that have a made up id, use a FeatureMerger to join the GroundSurface with the Building (building.gml_id = groundsurface.gml_parent_id). The gml_parent_id of the Building is the one you want. Otherwise, just get the gml_parent_id of the GroundSurface.

Hope this helps!


Hi rob_f,

you can add a citygml-importer. Be sure you use the workflow-option "individual featuretypes". That should help you to only read the groundsurfaces and buildings. The groundsurface is your footprint. Use the tester on the groundsurfaces for gml_parent_ID (search for containing string "fme-gen-") failed => gml_parent_id is your id. Passed => use the featuremerger to merge groundsurface (gml_parent_id) with building (gml_id), with that you'll get the rest of the IDs attached to your groundsurfaces.


Reply