Skip to main content
Question

CityGML - extract footprint and building id

  • December 4, 2015
  • 5 replies
  • 120 views

Forum|alt.badge.img

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

5 replies

Forum|alt.badge.img+5
  • December 4, 2015

Hey Rob,

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


redgeographics
Celebrity
Forum|alt.badge.img+50

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.


Forum|alt.badge.img
  • Author
  • December 4, 2015

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


Forum|alt.badge.img+5
  • December 7, 2015

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!


hth
Participant
Forum|alt.badge.img+2
  • Participant
  • February 29, 2016

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.


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