Opened 10 years ago

Closed 10 years ago

#2938 closed patch (fixed)

Patch for gml export of curved geometries

Reported by: mhugent Owned by: pramsey
Priority: medium Milestone: PostGIS 2.1.5
Component: postgis Version: 2.1.x
Keywords: Cc:

Description

This patch fixes a bug in the gml curve type export. The code did not handle compoundcurve rings in curved polygons so far. The attached patch adds the 'if( subgeom->type == COMPOUNDTYPE )' switch to the curved polygon export.

Attachments (3)

out_gml_compoundcurve_patch.diff (9.4 KB ) - added by mhugent 10 years ago.
141027_as_gml.diff (9.0 KB ) - added by mhugent 10 years ago.
New patch with tabs instead blanks
curvepolygon_gml3_export_fix.patch (5.1 KB ) - added by rouault 10 years ago.
Adds <gml:Ring> between <gml:exterior/interior> and <gml:curveMember>

Download all attachments as: .zip

Change History (10)

by mhugent, 10 years ago

comment:1 by pramsey, 10 years ago

Your patch unfortunately is mostly reformatting, removing the (postgis standard) tabs and replacing them with 4-spaces. Could you try a new patch that only includes the relevant alteration?

by mhugent, 10 years ago

Attachment: 141027_as_gml.diff added

New patch with tabs instead blanks

comment:2 by mhugent, 10 years ago

Oh, my editor inserted those spaces. The attached patch now uses tabs everywhere. The relevant change is that there is a switch for compoundurves in 'asgml3_curvepoly_size' and in 'asgml3_curvepoly_buf'. To avoid a compile error, I additionally had to move the methods 'asgml3_compound_size','asgml3_compound_buf', 'asgml3_compound' to be in front of the two changed methods (this might look like reformatting, but it is necessary for compilation).

comment:3 by pramsey, 10 years ago

Resolution: fixed
Status: newclosed

Thanks, in trunk at r13115

comment:4 by rouault, 10 years ago

I believe this export generates invalid GML that breaks both XML validation and OGR GML importer. Child elements of "exterior" can be LinearRing or Ring, but not directly curveMember. This is true for both GML 3.1.1 and GML 3.2.1. XML validation of

<gml:Polygon xmlns:gml="http://www.opengis.net/gml"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.opengis.net/gml
                                       http://schemas.opengis.net/gml/3.1.1/base/gml.xsd">
<gml:exterior><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension="2">763650.6 189057.1 7636.35 189045.2 763650.549 189057.844 763650.6 189057.1</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember></gml:exterior></gml:Polygon>

with the xmlvalidate.py utility from mapserver msautotest (based on libxml2)

$ python pymod/xmlvalidate.py -ogc_schemas_location wxs/SCHEMAS_OPENGIS_NET test.gml  

gives

Element '{http://www.opengis.net/gml}curveMember': This element is not expected. Expected is one of ( {http://www.opengis.net/gml}_Ring, {http://www.opengis.net/gml}LinearRing, {http://www.opengis.net/gml}Ring )., line 5

So the right export would be :

<gml:Polygon><gml:exterior><gml:Ring><gml:curveMember><gml:Curve><gml:segments><gml:LineStringSegment><gml:posList srsDimension="2">763650.6 189057.1 7636.35 189045.2 763650.549 189057.844 763650.6 189057.1</gml:posList></gml:LineStringSegment></gml:segments></gml:Curve></gml:curveMember></gml:Ring></gml:exterior></gml:Polygon>

comment:5 by rouault, 10 years ago

Resolution: fixed
Status: closedreopened

by rouault, 10 years ago

Adds <gml:Ring> between <gml:exterior/interior> and <gml:curveMember>

comment:6 by rouault, 10 years ago

Proposed fix attached : curvepolygon_gml3_export_fix.patch

comment:7 by pramsey, 10 years ago

Resolution: fixed
Status: reopenedclosed

Thanks Even, trunk at r13116

Note: See TracTickets for help on using tickets.