does OGR GML support multiple geometries

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

does OGR GML support multiple geometries

lucvanlinden
Hi

Tested 1.11 2.0beta of OGR (have no binaries at hand for latest stabble 2.X).

Trying to use gml with multiple geometries. Here is some simplified testcase.

testMydualGeom.xsd:

<?xml version="1.0" encoding="utf-8"?>
<xsd:schema
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:gml="http://www.opengis.net/gml"
  xmlns:gmlsf="http://www.opengis.net/gmlsf"
  xmlns:test="http://www.test.org/test"
  targetNamespace="http://www.test.org/test"
  elementFormDefault="qualified"
  version="0.1.0">

 
  <xsd:import
    namespace="http://www.w3.org/XML/1998/namespace"
    schemaLocation="http://www.w3.org/2001/xml.xsd"/>
  <xsd:import
    namespace="http://www.opengis.net/gml"
    schemaLocation="http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsf.xsd"/>
  <xsd:import
    namespace="http://www.opengis.net/gmlsf"
    schemaLocation="http://schemas.opengis.net/gml/3.1.1/profiles/gmlsfProfile/1.0.0/gmlsfLevels.xsd"/>


 
  <xsd:element
    name="MyDualGeomFeature"
    type="test:MyDualGeomFeature"
    substitutionGroup="gml:_Feature"/>

  <xsd:complexType name="MyDualGeomFeatureType">
    <xsd:complexContent>
      <xsd:extension base="gml:AbstractFeatureType">
        <xsd:sequence>
          <xsd:element name="componentID"
            type="xsd:string"
            minOccurs="0"
            maxOccurs="1"/>
          <xsd:element name="centerline"
            type="gml:CurvePropertyType"
            minOccurs="0"
            maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>
                The centerline spatial geometry of this component as it was installed.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:element>
          <xsd:element name="centerOf"
            type="gml:PointPropertyType"
            minOccurs="0"
            maxOccurs="1">
            <xsd:annotation>
              <xsd:documentation>
                The center point spatial geometry of this component as it was installed.
              </xsd:documentation>
            </xsd:annotation>
          </xsd:element>
        </xsd:sequence>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>
 

</xsd:schema>

testMydualGeom.gml file:

<?xml version="1.0" encoding="UTF-8"?>

<gml:FeatureCollection xmlns:gml="http://www.opengis.net/gml"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns="http://www.test.org/test"
  xsi:schemaLocation="http://www.test.org testMydualgeom.xsd"
  gml:id="1">

   
  <gml:featureMember>
    <MyDualGeomFeature gml:id="myMyDualGeomFeature1">
                <componentID>test1</componentID>
      <centerline>
        <gml:Point gml:id="geom1" srsName="EPSG:4326">
          <gml:pos>30.095472861000076 -96.079962905999992</gml:pos>
        </gml:Point>
      </centerline>
      <centerOf>
        <gml:Point gml:id="geom2" srsName="EPSG:4326">
          <gml:pos>30.095472861000076 -96.079962905999992</gml:pos>
        </gml:Point>
      </centerOf>
    </MyDualGeomFeature>
  </gml:featureMember>
 

</gml:FeatureCollection>


Ogrinfo reports only one geometry. The gfs file has the following: <GeometryType>1</GeometryType>

I know and succesfully tested the editing of the gfs file for getting the 2 geometries reckognised by Ogr.

My question, although reading http://www.gdal.org/drv_gml.html

"But, starting with OGR 1.11, if the .xsd schema is understood by the XSD parser and declares several geometry fields, or the .gfs file declares several geometry fields, multiple geometry fields will be reported by the GML driver according to RFC 41."

I would have assumed the xsd would be read correctly to identify the 2 geometry fields.
(also included -oo XSD=testMydualGeom.xsd (for the 2.0beta release).

question is: is this working (ogr gml multiple geometries reading) in a recent stable 2.X?

tx

Luc



Reply | Threaded
Open this post in threaded view
|

Re: does OGR GML support multiple geometries

Even Rouault-2
Luc,

>
>   <xsd:element
>     name="MyDualGeomFeature"
>     type="test:MyDualGeomFeature"

==> This should by type="test:MyDualGeomFeatureType"

Once corrected, with GDAL 1.11 or above :

$ ogrinfo ../../trunk/gdal/test.gml -al
Had to open data source read-only.
INFO: Open of `../../trunk/gdal/test.gml'
      using driver `GML' successful.

Layer name: MyDualGeomFeature
Geometry (centerline): Line String
Geometry (centerOf): Point
Feature Count: 1
Extent (centerline): (30.095473, -96.079963) - (30.095473, -96.079963)
Extent (centerOf): (30.095473, -96.079963) - (30.095473, -96.079963)
SRS WKT (centerline):
(unknown)
SRS WKT (centerOf):
(unknown)
Geometry Column 1 = centerline
Geometry Column 2 = centerOf
gml_id: String (0.0)
componentID: String (0.0)
OGRFeature(MyDualGeomFeature):1
  gml_id (String) = myMyDualGeomFeature1
  componentID (String) = test1
  centerline = POINT (30.095472861000079 -96.079962906)
  centerOf = POINT (30.095472861000079 -96.079962906)

Even

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev