cleder / fastkml

Fast 🌍️ <KML /> processing for python
https://fastkml.readthedocs.io
229 stars 92 forks source link

Add kml:Model #396

Open cleder opened 1 day ago

cleder commented 1 day ago

https://developers.google.com/kml/documentation/models https://developers.google.com/kml/documentation/kmlreference#model

Schema:

  <element name="Model" type="kml:ModelType"
    substitutionGroup="kml:AbstractGeometryGroup"/>
  <complexType name="ModelType" final="#all">
    <complexContent>
      <extension base="kml:AbstractGeometryType">
        <sequence>
          <element ref="kml:altitudeModeGroup" minOccurs="0"/>
          <element ref="kml:Location" minOccurs="0"/>
          <element ref="kml:Orientation" minOccurs="0"/>
          <element ref="kml:Scale" minOccurs="0"/>
          <element ref="kml:Link" minOccurs="0"/>
          <element ref="kml:ResourceMap" minOccurs="0"/>
          <element ref="kml:ModelSimpleExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
          <element ref="kml:ModelObjectExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <element name="ModelSimpleExtensionGroup" abstract="true"
    type="anySimpleType"/>
  <element name="ModelObjectExtensionGroup" abstract="true"
    substitutionGroup="kml:AbstractObjectGroup"/>

  <element name="Location" type="kml:LocationType"
    substitutionGroup="kml:AbstractObjectGroup"/>
  <complexType name="LocationType" final="#all">
    <complexContent>
      <extension base="kml:AbstractObjectType">
        <sequence>
          <element ref="kml:longitude" minOccurs="0"/>
          <element ref="kml:latitude" minOccurs="0"/>
          <element ref="kml:altitude" minOccurs="0"/>
          <element ref="kml:LocationSimpleExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
          <element ref="kml:LocationObjectExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <element name="LocationSimpleExtensionGroup" abstract="true"
    type="anySimpleType"/>
  <element name="LocationObjectExtensionGroup" abstract="true"
    substitutionGroup="kml:AbstractObjectGroup"/>

  <element name="Orientation" type="kml:OrientationType"
    substitutionGroup="kml:AbstractObjectGroup"/>
  <complexType name="OrientationType" final="#all">
    <complexContent>
      <extension base="kml:AbstractObjectType">
        <sequence>
          <element ref="kml:heading" minOccurs="0"/>
          <element ref="kml:tilt" minOccurs="0"/>
          <element ref="kml:roll" minOccurs="0"/>
          <element ref="kml:OrientationSimpleExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
          <element ref="kml:OrientationObjectExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <element name="OrientationSimpleExtensionGroup" abstract="true"
    type="anySimpleType"/>
  <element name="OrientationObjectExtensionGroup" abstract="true"
    substitutionGroup="kml:AbstractObjectGroup"/>

  <element name="Scale" type="kml:ScaleType"
    substitutionGroup="kml:AbstractObjectGroup"/>
  <complexType name="ScaleType" final="#all">
    <complexContent>
      <extension base="kml:AbstractObjectType">
        <sequence>
          <element ref="kml:x" minOccurs="0"/>
          <element ref="kml:y" minOccurs="0"/>
          <element ref="kml:z" minOccurs="0"/>
          <element ref="kml:ScaleSimpleExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
          <element ref="kml:ScaleObjectExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <element name="ScaleSimpleExtensionGroup" abstract="true"
    type="anySimpleType"/>
  <element name="ScaleObjectExtensionGroup" abstract="true"
    substitutionGroup="kml:AbstractObjectGroup"/>

  <element name="ResourceMap" type="kml:ResourceMapType"
    substitutionGroup="kml:AbstractObjectGroup"/>
  <complexType name="ResourceMapType" final="#all">
    <complexContent>
      <extension base="kml:AbstractObjectType">
        <sequence>
          <element ref="kml:Alias" minOccurs="0" maxOccurs="unbounded"/>
          <element ref="kml:ResourceMapSimpleExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
          <element ref="kml:ResourceMapObjectExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <element name="ResourceMapSimpleExtensionGroup" abstract="true"
    type="anySimpleType"/>
  <element name="ResourceMapObjectExtensionGroup" abstract="true"
    substitutionGroup="kml:AbstractObjectGroup"/>

  <element name="Alias" type="kml:AliasType"
    substitutionGroup="kml:AbstractObjectGroup"/>
  <complexType name="AliasType" final="#all">
    <complexContent>
      <extension base="kml:AbstractObjectType">
        <sequence>
          <element ref="kml:targetHref" minOccurs="0"/>
          <element ref="kml:sourceHref" minOccurs="0"/>
          <element ref="kml:AliasSimpleExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
          <element ref="kml:AliasObjectExtensionGroup" minOccurs="0"
            maxOccurs="unbounded"/>
        </sequence>
      </extension>
    </complexContent>
  </complexType>
  <element name="AliasSimpleExtensionGroup" abstract="true"
    type="anySimpleType"/>
  <element name="AliasObjectExtensionGroup" abstract="true"
    substitutionGroup="kml:AbstractObjectGroup"/>

Examples:

          <Model>
            <altitudeMode>absolute</altitudeMode>
            <Location>
              <longitude>-123.115776547816</longitude>
              <latitude>49.279804095564</latitude>
              <altitude>21.614010375743</altitude>
            </Location>
            <Scale><x>1</x><y>1</y><z>1</z></Scale>
            <Link><href>http://barcelona.galdos.local/svn1/sqa/ets-kml/main/test/data/ogc-kml/files/PublicLibrary.dae</href></Link>
            <ResourceMap id="map01">
              <Alias>
                <targetHref>http://barcelona.galdos.local/svn1/sqa/ets-kml/main/test/data/ogc-kml/images/Concrete2.jpg</targetHref>
                <sourceHref>../images/Concrete.jpg</sourceHref>
              </Alias>
            </ResourceMap>
          </Model>
        <Model>
          <Location>
            <longitude>2.2945</longitude>
            <latitude>48.85825</latitude>
          </Location>
          <Scale>
            <x>1</x>
            <y>1</y>
            <z>1</z>
          </Scale>
          <Link>
            <href>./cube.dae</href>
          </Link>
          <ResourceMap>
            <Alias>
              <targetHref>cube2.gif</targetHref>
              <sourceHref>cube.gif</sourceHref>
            </Alias>
          </ResourceMap>
        </Model>
<kml:Model xmlns:kml="http://www.opengis.net/kml/2.2">
  <kml:Location />
  <kml:Link>
    <kml:href>./un.dae</kml:href>
  </kml:Link>
  <kml:ResourceMap>
    <kml:Alias>
      <kml:targetHref>01.jpg</kml:targetHref>
      <kml:sourceHref>../../img/_01.jpg</kml:sourceHref>
    </kml:Alias>
  </kml:ResourceMap>
</kml:Model>