Opened 18 years ago

Closed 18 years ago

#1569 closed defect (fixed)

[GML] MapServer's MultiLineString does not load in OGR

Reported by: jlacroix Owned by: warmerdam
Priority: high Milestone:
Component: OGR Support Version: 4.8
Severity: normal Keywords:
Cc:

Description

A gml:MultiLineString built by MapServer is not loadable by OGR GML driver. I'm
not sure if it's a OGR or a MapServer bug, so I open it here to make sure Steve
and Frank see it.

This is an example of a MultiLineString returned by MapServer (I removed a lot
of coordinates). OGR wants to enclose each linestring tags with a
<gml:LineStringMember></gml:LineStringMember>.


<?xml version='1.0' encoding="ISO-8859-1" ?>
<wfs:FeatureCollection
   xmlns:sandre="http://www.sandre.eaufrance.fr/"
   xmlns:wfs="http://www.opengis.net/wfs"
   xmlns:gml="http://www.opengis.net/gml"
   xmlns:ogc="http://www.opengis.net/ogc"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengeospatial.net/wfs/1.0.0/WFS-basic.xsd 
                       http://www.sandre.eaufrance.fr/
http://services.sandre.eaufrance.fr/geo/zonage?SERVICE=WFS&amp;VERSION=1.0.0&amp;REQUEST=DescribeFeatureType&amp;TYPENAME=LAISB&amp;OUTPUTFORMAT=XMLSCHEMA">
      <gml:boundedBy>
      	<gml:Box srsName="EPSG:4326">
      		<gml:coordinates>-5.509786,43.058269 3.533258,51.120253</gml:coordinates>
      	</gml:Box>
      </gml:boundedBy>
    <gml:featureMember>
      <sandre:LAISB>
        <gml:boundedBy>
        	<gml:Box srsName="EPSG:4326">
        		<gml:coordinates>47256.000000,1807804.000000
684036.000000,2680865.000000</gml:coordinates>
        	</gml:Box>
        </gml:boundedBy>
        <sandre:msGeometry>
        <gml:MultiLineString srsName="EPSG:4326">
          <gml:LineString>
            <gml:coordinates>-2.163496,46.870251 -2.164254,46.870672
</gml:coordinates>
          </gml:LineString>
        </gml:MultiLineString>
        </sandre:msGeometry>
        <sandre:ID>2309</sandre:ID>
        <sandre:CODE>LAIS3149017290006622</sandre:CODE>
        <sandre:LIBELLE>Limite des plus basses eaux (fermeture arbitraire
d&#39;un estuaire)

</sandre:LIBELLE>
      </sandre:LAISB>
    </gml:featureMember>
</wfs:FeatureCollection>

Change History (7)

comment:1 by fwarmerdam, 18 years ago

Status: newassigned
The file has this for the multilinestring:

       <gml:MultiLineString srsName="EPSG:4326">
         <gml:LineString>
           <gml:coordinates>-2.163496,46.870251 -2.164254,46.870672
</gml:coordinates>
         </gml:LineString>
       </gml:MultiLineString>


It seems that OGR expects:
       <gml:MultiLineString srsName="EPSG:4326">
        <gml:lineStringMember>
         <gml:LineString>
           <gml:coordinates>-2.163496,46.870251 -2.164254,46.870672
</gml:coordinates>
         </gml:LineString>
        </gml:lineStringMember>
       </gml:MultiLineString>

I have a sample on file that looks like:

        <gml:MultiLineString srsName=" ">
          <gml:lineStringMember>
            <gml:coordinates>0.629887,0.167182 1.024843,0.244457
1.024843,0.046978 0.981913,-0.073226 0.647059,-0.004538 0.612715,0.081322
0.629887,0.167182 </gml:coordinates>
          </gml:lineStringMember>
          <gml:lineStringMember>
            <gml:coordinates>1.110703,0.261629 1.222321,0.072736
1.196563,0.304559 </gml:coordinates>
          </gml:lineStringMember>
        </gml:MultiLineString>

I will do a bit of digging in the specification...

comment:2 by fwarmerdam, 18 years ago

OK, I have reviewed the GML 2.1.2 specification document and it shows the 
following example:

<MultiLineString srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
  <lineStringMember>
    <LineString>
      <coord><X>56.1< /X><Y>0.45</Y></coor d>
      <coord><X>67.23 </X><Y>0.98</Y></coo rd>
    </LineString>
  </lineStringMember>
  <lineStringMember>
    <LineString>
      <coord><X>46.71 </X><Y>9.25</Y></coo rd>
      <coord><X>56.88 </X><Y>10.44</Y></co ord>
    </LineString>
  </lineStringMember>
  <lineStringMember>
    <LineString>
      <coord><X>324.1 </X><Y>219.7</Y></co ord>
      <coord><X>0.45< /X><Y>4.56</Y></coor d>
    </LineString>
  </lineStringMember>
</MultiLineString>

the .xsd states:
  <complexType name="MultiLineStringType">
    <annotation>
      <documentation>
        A MultiLineString is defined by one or more LineStrings, referenced 
        through lineStringMember elements.
      </documentation>
    </annotation>
    <complexContent>
      <restriction base="gml:GeometryCollectionType">
        <sequence>
          <element ref="gml:lineStringMember" maxOccurs="unbounded"/>
        </sequence>
        <attribute name="gid" type="ID" use="optional"/>
        <attribute name="srsName" type="anyURI" use="required"/>
      </restriction>
    </complexContent>
  </complexType>

This all seems to support the idea that in GML 2 the MultiLineString
element should have one or more lineStringMember children elements 
each with a LineString child. 

I think we should change the GML 2.x generation in MapServer accordingly
unless there is some contrary evidence. 

I have not review the GML 3 specification for multilinestrings. 

Steve, would you like me to modify mapgml.c, or would you like to do it?

comment:3 by sdlime, 18 years ago

Status: assignednew
Please feel free to update the GML 2 writer. Could they make GML any more verbose?

Steve

comment:4 by jlacroix, 18 years ago

Can we see this in 4.8? Is it too late?
Frank, I can do it if you don't have the time.

comment:5 by sdlime, 18 years ago

Julien: This is a pretty benign fix so I'd say go ahead and fix. Let me know if 
you find other issues.

Steve

comment:6 by fwarmerdam, 18 years ago

Julien,

Sorry for dropping the ball on this one.  Please go ahead and
make the fix. 

comment:7 by jlacroix, 18 years ago

Resolution: fixed
Status: newclosed
I added hte tag 
<gml:lineStringMember>...</gml:lineStringMember>
around the LineString members in both 4.8 and 4.9 branch.

Marking as FIXED

Note: See TracTickets for help on using tickets.