[gdal-dev] GML Invalid exterior ring
Moffatt, Greg
Greg.Moffatt at amec.com
Thu Dec 20 11:23:58 PST 2012
I think my response to Even didn't make it to the list; apologies, Even, for the redundant e-mail.
Even, thank you so much. I have logged a ticket on the issue (#4934). You're right - the XML is far more verbose than it needs to be, although that seems to be a trait of SQL Server's FOR XML clause.
In the meantime, I stripped the redundant attributes from the XML by casting it to a varchar(max), replacing the namespace attributes with nothing, and then replacing the root tag with one containing the attributes. Casted that varchar back to XML and voila - everything works again.
Not the most eloquent solution, but it works.
Happy holidays to all,
Greg
-----Original Message-----
From: Even Rouault [mailto:even.rouault at mines-paris.org]
Sent: December-20-12 11:53 AM
To: Moffatt, Greg
Cc: gdal-dev at lists.osgeo.org
Subject: Re: [gdal-dev] GML Invalid exterior ring
Selon "Moffatt, Greg" <Greg.Moffatt at amec.com>:
> Hi all,
>
>
>
> I've tried this query on the ms4w and mapserver lists without luck, so please
> forgive my cross-post. I think the issue is somehow related to GDAL/OGR, so
> I'm hoping someone on this list can shed some light.
>
>
>
> I have a GML file that's generated by SQL Server that contains one or more
> polygons. It used to work, but since I've upgraded the ms4w installation on
> my web server, any requests to MapServer for that layer fail with the
> message: msOGRFileNextShape(): OGR error. Invalid exterior ring.
>
>
> GDAL changed from 1.8.1RC2 to 1.9.0 in that step. I've looked through the
> GDAL release notes, but nothing is jumping out at me.
>
>
>
> Any idea why MapServer (or OGR specifically) might balk at the GML?
ok, I've reproduced the issue with your sample. Would you mind opening a ticket
at http://trac.osgeo.org/gdal/newticket about that ?
The issue is due that newer OGR versions now preserve the XML attributes of the
geometry elements of the GML, but the original parser of the GML geometries
isn't robust to ignoring attributes it doesn't know how to deal with. Namely in
your example the issue is with :
<gml:outerBoundaryIs xmlns:ms="http://mapserver.gis.umn.edu/mapserver"
xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogr="http://www.opengis.net/ogr"
xmlns:gml="http://www.opengis.net/gml">
If you remove all the attributes that define namespaces, it will work :
<gml:outerBoundaryIs>
I'll make the parser more robust, since the GML is well valid (but very verbose
! : why repeating the namespaces on all nodes ?)
Best regards,
Even
The information contained in this e-mail is intended only for the individual or entity to whom it is addressed.
Its contents (including any attachments) may contain confidential and/or privileged information.
If you are not an intended recipient you must not use, disclose, disseminate, copy or print its contents.
If you receive this e-mail in error, please notify the sender by reply e-mail and delete and destroy the message.
More information about the gdal-dev
mailing list