7.2 CityGML 配置文件
CityGML配置文件是主题扩展模块与CityGML核心模块的结合。每个CityGML实例文档都将应采用与所提供数据相匹配的CityGML 配置文件。通常,有两种方式来区分一个实例文档是否使用CityGML配置文件 :
1.CityGML配置文件的定义嵌入在CityGML实例文档中
CityGML配置文件可以使用在XMLSchema实例名称空间中定义的schemaLocation属性绑定到实例文档中,http://www.w3.org/2001/XMLSchema-instance(通常与前缀xsi关联)。在一个XML 实例文档中,xsi:schemaLocation属性提供了一种能定位已定义了命名空间的XML模式定义的方法。它的值是一个以空格分隔的统一资源标识符(URI)对列表,其中每对都由一个命名空间组成,后面跟着该命名空间的XML Schema定义的位置,该定义通常是.xsd文件。
通过这种方式,各个CityGML模块的名称空间在CityGML实例文档中进行定义。然后,xsi:schemaLocation属性用来为每个模块的XML Schema定义提供位置。附件G中给出的所有实例文件都遵循第一种方法。
2.CityGML配置文件定义由单独的XML schema文件提供
CityGML配置文件也可以由其自己的XML Schema文件指定。该模式文件通过导入相应的XML Schema定义来组合适当的CityGML模块。这种情况下,应使用XML Schema命名空间中定义的 import元素,http://www.w3.org/2001/XMLSchema (通常与前缀xs关联)。对于xs:import元素,必须声明导入的CityGML模块的命名空间以及命名空间的XMLSchema定义的位置。为了将CityGML配置文件应用于实例文档,必须使用xsi:schemaLocation属性将配置文件的schema绑定到实例文档。CityGML配置文件的XML Schema文件不得包含任何更进一步的内容。
配置文件格式中的targetNamespace应与导入的CityGML模块的命名空间不同。与配置文件关联的命名空间应该由实例文档的发起者控制,并且必须作为以前未使用的全局唯一URI进行提供。分析相关CityGML实例文档的每个人都必须可以使用(或可以在互联网上访问)配置文件的XML Schema文件。
第二种方法通过以下CityGML基本配置文件的XMLSchema定义示例进行了说明。由于基本概要文件是所有CityGML模块的并集,因此相应的XMLSchema定义会导入每个CityGML模块。通过这种方式,CityGML数据模型的所有组件都可以进行使用,并且可以通过引用此示例基本配置文件的实例文档进行交换。基本配置文件的模式定义文件随CityGML模式包一起提供,可访问http://schemas.opengis.net/citygml/profiles/base/2.0/City
> <xs:schema xmlns="http://www.opengis.net/citygml/profiles/base/2.0"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://www.opengis.net/citygml/profiles/base/2.0"
> elementFormDefault="qualified" attributeFormDefault="unqualified"
> version="2.0.0"> <xs:import
> namespace="http://www.opengis.net/citygml/appearance/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/appearance/2.0/appearance.xsd"/>
> <xs:import namespace="http://www.opengis.net/citygml/bridge/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/bridge/2.0/bridge.xsd"/>
> <xs:import namespace="http://www.opengis.net/citygml/building/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/building/2.0/building.xsd"/>
> <xs:import
> namespace="http://www.opengis.net/citygml/cityfurniture/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/cityfurniture/2.0/cityFurniture.xsd"/>
> <xs:import
> namespace="http://www.opengis.net/citygml/cityobjectgroup/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/cityobjectgroup/2.0/cityObjectGroup.xsd"/>
> <xs:import namespace="http://www.opengis.net/citygml/generics/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/generics/2.0/generics.xsd"/>
> <xs:import namespace="http://www.opengis.net/citygml/landuse/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/landuse/2.0/landUse.xsd"/>
> <xs:import namespace="http://www.opengis.net/citygml/relief/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/relief/2.0/relief.xsd"/>
> <xs:import
> namespace="http://www.opengis.net/citygml/transportation/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/transportation/2.0/transportation.xsd"/>
> <xs:import namespace="http://www.opengis.net/citygml/tunnel/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/tunnel/2.0/tunnel.xsd"/>
> <xs:import namespace="http://www.opengis.net/citygml/vegetation/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/vegetation/2.0/vegetation.xsd"/>
> <xs:import namespace="http://www.opengis.net/citygml/waterbody/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/waterbody/2.0/waterBody.xsd"/>
> <xs:import
> namespace="http://www.opengis.net/citygml/texturedsurface/2.0"
> schemaLocation="http://schemas.opengis.net/citygml/texturedsurface/2.0/texturedSurface.xsd"/>
> </xs:schema>
以下CityGML数据集摘录举例说明了如何将基本配置文件schema CityGML.xsd应用于CityGML实例文档。该数据集包含两个建筑对象和一个城市对象组。CityGML.xsd定义的基本配置文件是使用根元素的xsi:schemaLocation属性引用的。因此,实例文档使用了所有CityGML模块,不需要进一步引用CityGML模块的XMLSchema文档。
<core:CityModel xmlns="http://www.opengis.net/citygml/profiles/base/2.0"
xmlns:core="http://www.opengis.net/citygml/2.0"
xmlns:bldg="http://www.opengis.net/citygml/building/2.0"
xmlns:grp="http://www.opengis.net/citygml/cityobjectgroup/2.0"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xAL="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/citygml/profiles/base/2.0
http://schemas.opengis.net/citygml/profiles/base/2.0/CityGML.xsd">
<core:cityObjectMember>
<bldg:Building gml:id="Build0815">
<core:externalReference>
<core:informationSystem>http://www.adv-online.de</core:informationSystem>
<core:externalObject>
<core:uri>urn:adv:oid:DEHE123400007001</core:uri>
</core:externalObject>
</core:externalReference>
<bldg:function
codeSpace="http://www.sig3d.org/codelists/standard/building/2.0/_AbstractBuilding_function.xml">1000</bldg:function>
<bldg:yearOfConstruction>1985</bldg:yearOfConstruction>
<bldg:roofType
codeSpace="http://www.sig3d.org/codelists/standard//building/2.0/_AbstractBuilding_roofType.xml">1030</bldg:roofType>
<bldg:measuredHeight uom="#m">8.0</bldg:measuredHeight>
<bldg:storeysAboveGround>2</bldg:storeysAboveGround>
<bldg:storeyHeightsAboveGround uom="#m">2.5 2.5</bldg:storeyHeightsAboveGround>
<bldg:lod2Solid> ... </bldg:lod2Solid>
</bldg:Building>
</core:cityObjectMember>
<core:cityObjectMember>
<bldg:Building gml:id="Build0817">
…
</bldg:Building>
</core:cityObjectMember>
<core:cityObjectMember>
<grp:CityObjectGroup gml:id="Complex113">
<gml:name>Hotel complex 'Scenic View'</gml:name>
<grp:function>building group</grp:function>
<grp:groupMember role="main building" xlink:href="#Build0817"/>
<grp:groupMember xlink:href="#Build0815"/>
</grp:CityObjectGroup>
</core:cityObjectMember>
</core:CityModel>