[gdal-dev] Why MultiLinestring in GeometryCollection is unexpected for SQLite dialect?

Rahkonen Jukka (MML) jukka.rahkonen at maanmittauslaitos.fi
Wed Dec 11 07:58:37 PST 2019


Hi,

This command fails with SQLite dialect

ogrinfo -dialect sqlite -sql "select geometry from jump_gc as geom" jump_gc.jml
Had to open data source read-only.
INFO: Open of `jump_gc.jml'
      using driver `JML' successful.
ERROR 1: Unexpected geometry type MULTILINESTRING as part of GEOMETRYCOLLECTION

Layer name: SELECT
Geometry: Unknown (any)
Feature Count: 1
Layer SRS WKT:
(unknown)
Geometry Column = GEOMETRY
ERROR 1: Unexpected geometry type MULTILINESTRING as part of GEOMETRYCOLLECTION
OGRFeature(SELECT):0

Result is fine with OGR SQL

ogrinfo  -sql "select ogr_geometry from jump_gc as geom" jump_gc.jml
Had to open data source read-only.
INFO: Open of `jump_gc.jml'
      using driver `JML' successful.

Layer name: geom
Geometry: Unknown (any)
Feature Count: 1
Extent: (1.000000, 3.000000) - (560.000000, 500.000000)
Layer SRS WKT:
(unknown)
ogr_geometry: String (0.0)
OGRFeature(geom):0
  ogr_geometry (String) = GEOMETRYCOLLECTION
  GEOMETRYCOLLECTION (MULTILINESTRING ((280 420,540 420,560 440,540 440),(300 460,480 460,520 500)),POINT (1 3))

SQLite dialect does not complain if I convert the same geometry from WKT into geometry and back to WKT

ogrinfo -dialect sqlite -sql "select st_astext(st_geomfromtext('GEOMETRYCOLLECTION ( MULTILINESTRING (( 280 420, 540 420, 560 440, 540 440 ), ( 300 460, 480 460, 520 500 )),POINT(1 3))')) as wkt" jump_gc.jml

Here is my test data "jump_gc.jml":

<?xml version='1.0' encoding='UTF-8'?>
<JCSDataFile xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance" >
<JCSGMLInputTemplate>
<CollectionElement>featureCollection</CollectionElement>
<FeatureElement>feature</FeatureElement>
<GeometryElement>geometry</GeometryElement>
<CRSElement>boundedBy</CRSElement>
<ColumnDefinitions>
</ColumnDefinitions>
</JCSGMLInputTemplate>

<featureCollection>
  <gml:boundedBy>
    <gml:Box>
      <gml:coordinates decimal="." cs="," ts=" ">1.00,3.00 560.00,500.00</gml:coordinates>
    </gml:Box>
  </gml:boundedBy>
  <feature>
    <geometry>
      <gml:MultiGeometry>
        <gml:geometryMember>
        <gml:MultiLineString>
          <gml:lineStringMember>
          <gml:LineString>
            <gml:coordinates>
              280.0,420.0
              540.0,420.0
              560.0,440.0
              540.0,440.0
            </gml:coordinates>
          </gml:LineString>
          </gml:lineStringMember>
          <gml:lineStringMember>
          <gml:LineString>
            <gml:coordinates>
              300.0,460.0
              480.0,460.0
              520.0,500.0
            </gml:coordinates>
          </gml:LineString>
          </gml:lineStringMember>
        </gml:MultiLineString>
        </gml:geometryMember>
        <gml:geometryMember>
        <gml:Point>
          <gml:coordinates>
            1.0,3.0
          </gml:coordinates>
        </gml:Point>
        </gml:geometryMember>
      </gml:MultiGeometry>
    </geometry>
  </feature>
</featureCollection>
</JCSDataFile>

-Jukka Rahkonen-
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20191211/0d8db8c2/attachment.html>


More information about the gdal-dev mailing list