Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • 3 3D-Stadtmodelle
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • Volker Coors
  • 3D-Stadtmodelle
  • Wiki
  • En
  • Citygml tutorial
  • Extras
Last edited by Rushikesh Padsala 2 years ago
Page history

Extras

Adding a schematic attribute to the CityGML dataset (Schematic Attribute: Year of Construction)

This example shows how to add a schematic attribute (here: year_of_construction) to an existing CityGML document using FME. The same method can be used for adding any schematic attribute(s) by attribute join to any CityGML CityObjects irrespective of its Level Of Detail. For example purpose here, CityGML 2.0 building dataset is used.

Method 1: Using feature merger and attribute creator

With this method, you first add another reader to the workbench (here: CSV). Then in the feature merger transformer, you connect port from "CityGML Building" to requestor port and, CSV to supplier port. Inside, feature merger mapping on gml_ID is done. The output port "Merged" is then connected to the attribute creator transformer. Within attribute creator, select "citygml_year_of_construction" under new attribute and the CSV field containing year of construction values under attribute value. Connect the output port to the writer port of "CityGML Building" and run the workbench.

An example workbench is available here.

image

The output CityGML file will contain the schematic attribute for year of construction.

image

Method 2: Using database joiner and attribute manager

In this method, instead of adding another reader database joiner, transformer is used to connect datasets based on gml_id or any primary key. Here you connect the port from "CityGML Building" to the input port of database joiner transformer. Inside the transformer you select your database (here: CSV), select the CSV table and then map your gml_id from the CityGML file to gml_id from the CSV file. Under "Fields to Add", the field containing year of construction values is selected (here: construction ). Also, make sure to set cardinality to 1:0..1. This will prevent unmatched gml_id from giving you an error and terminating the workbench. Next connect the joined port of database joiner to attribute manager input port. Inside attribute manager, in front of the "citygml_year_of_construction" assign value "construction ". Join the output port to the writer port of "CityGML Building" and run the workbench.

An example workbench is available here.

image

The output CityGML file will contain the schematic attribute for year of construction.

image

The difference between using database joiner and feature merger (CSV as a reader), is that CSV reader with cache all the data from the CSV file on your local machine. This is not a good practice particularly when working with a large dataset. With a database joiner, the transformer will read your database on fly and hence will not cache any data on your local machine. This saves time, memory and disk space.

Adding a generic attribute to the CityGML dataset (Generic Attribute: Specific Space Heating Demand)

In this example, we will add a generic attribute (here: specific space heating demand) to an existing CityGML document using FME. The same method can be used for adding any generic attribute(s) by attribute join to any CityGML CityObjects irrespective of its Level Of Detail. For example purpose here, CityGML 2.0 building dataset for HFT campus in LOD2 is used. For adding generic attribute of Specific space heating demand to HFT CityGML file, SimStadt simulated heating energy demand result is used. Database joiner method is used in this example as explained above.

First, we connect the port from "CityGML Building" to the input port of database joiner transformer. Inside the transformer you select your database (here: CSV), select the CSV table and then map your gml_id from the CityGML file to GMLId from the CSV file. Under "Fields to Add", the field containing specific space heating demand values is selected (here: Specific space heating demand ). Also make sure to set cardinality to 1:0..1. This will prevent unmatched gml_id from giving you an error and terminating the workbench. Next we will join the output port to the writer port of "CityGML Building". At this point, the new attribute of Specific space heating demand must be added to the attribute list of CityGML building. To access the existing attribute list of CityGML building, click on wheel icon image. Next, select the User Attributes tab and manually add the new attribute Specific space heating demand with xml_real64 type. Now save and run the workbench.

An easier way to define new generic attributes would be to switch "Attribute Definition" from Manual to Automatic. This will reduce time to manually add all the new generic attributes to the CityGML attribute list but for all the newly added generic attributes FME will define their type based on their data type defined in the input database (e.g. excel, CSV, Postgres etc.). To manually change a data type, switch back to Manuall attribute definition.

The complete FME workbench along with its input and outputs can be downloaded from here.

image

If the generic attribute to be added is not part of a database (e.g excel, CSV, Postgres etc.) then use Attribute Creator transformer instead of database joiner and then follow the above process.

The output CityGML file will contain the generic attribute for Specific space heating demand.

image

Adding an Address to the CityGML dataset

Addresses are specified in CityGML according to the xAL address standard (OASIS 2003)1. This is a general schema for all types of international addresses. Each building (Building) or building part (BuildingPart) can have one or more addresses.

CityGML_2.0_Address_UML.drawio

In the following, the mapping of addresses is integrated into the previous FME process for generating LoD1 building models from shapefile. Method of "Feature merger and attribute creator" is used to integrate attributes in the CityGML model. An address is given for each building in a spreadsheet. The address is described with the attributes street, house number, postcode and town. Transformer XML templater can be used in FME to map these attributes into the xAL scheme for addresses.

image

The template for the addresses looks like this:

<core:xalAddress xmlns:core="http://www.opengis.net/citygml/2.0">
       <xAL:AddressDetails xmlns:xAL="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">           
           <xAL:Locality Type="Town">
                 <xAL:LocalityName>{fme:get-attribute("Ort")}</xAL:LocalityName>
                <xAL:Thoroughfare Type="Street">
                    <xAL:ThoroughfareNumber>{fme:get-attribute("Hausnummer")}</xAL:ThoroughfareNumber>
                    <xAL:ThoroughfareName>{fme:get-attribute("Strasse")}</xAL:ThoroughfareName>
                </xAL:Thoroughfare>
                <xAL:PostalCode>
                    <xAL:PostalCodeNumber>{fme:get-attribute("PLZ")}</xAL:PostalCodeNumber>
                </xAL:PostalCode>
            </xAL:Locality>
        </xAL:AddressDetails>
</core:xalAddress>

In order to connect the address to the CityGML Building , a citygml_feature_role attribute must be created analogous to the citygml_lod_name . An AttributeCreator transformer is used again for this. The attribute citygml_feature_role must be "address".

Kap-2-1-Workbench_AttributeCreator-2

The address must then be assigned to the building. To do this, a new CityGML Writer must be created. It is best to delete the existing writer first 2. Select the Building and Address feature types for the new writer . The address is linked to the citygml_parent_id in the writer via the ID.

image

The resulting CityGML document now has the following structure: image

The complete FME workbench along with sample dataset can be downloaded from here.

  1. eXtensible Address Language, Namespace – urn:oasis:names:tc:ciq:xsdschema:xAl:2.0 :leftwards_arrow_with_hook:

  2. And also the output file if it already exists. Otherwise, the writer only takes feature types that occur in this CityGML document. :leftwards_arrow_with_hook:

Clone repository
  • DE
    • Buch 3D Stadtmodelle
    • Buch 3D Stadtmodelle
      • Kap 4: Objektmodell
      • Kap 5: Digitales Geländemodell
      • Kap 6: Die Bodenbedeckung
      • Kap 7: Gebäudemodell
      • Kap 8: Vegetation
    • Konferenzen
    • Open Data
    • Vorlesung 3D Stadtmodelle
    • Vorlesung 3D Stadtmodelle
      • Kap 2.1 Teil 1 Gebäudemodell Lod 1
      • Kap 2.1 Teil 2 Gebäudemodell Lod 1 mit Attributen
      • Kap 2.2 Gebäudemodell LoD 2
      • Kap 3 ArcGIS CityEngine
      • weiteres
  • EN
    • CityGML Tutorial
View All Pages

Menu

Explore Projects Groups Snippets

Dies ist die Gitlab-Instanz des Transferportals der Hochschule für Technik Stuttgart. Hier geht es zurück zum Portal