[postgis-devel] lwgeom_gml.c patch
Eric Lemoine
Eric.Lemoine at camptocamp.com
Tue Mar 6 22:09:48 PST 2007
Hi
Here is a patch to lwgeom_gml.c. This patch fixes the output
of asgml() for polygons, adding the tags <gml:LinearRing>
and <gml:coordinates> which were missing.
Patch applies to current svn trunk.
PS: patch is appended below for comment, and also attached for a
well-formatted patch to apply.
Thanks,
--
Eric
Index: lwgeom/lwgeom_gml.c
===================================================================
--- lwgeom/lwgeom_gml.c (revision 2594)
+++ lwgeom/lwgeom_gml.c (working copy)
@@ -223,10 +223,16 @@
size_t size;
int i;
- size = sizeof("<gml:polygon></gml:polygon>");
- size += sizeof("<gml:outerboundaryis><gml:linearring>/") * 2;
- size += sizeof("<gml:innerboundaryis><gml:linearring>/") * 2 *
- poly->nrings;
+ size = sizeof("<gml:Polygon>");
+
+ size += sizeof("<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>");
+ size += sizeof("</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>");
+
+ size += sizeof("<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>")
* (poly->nrings - 1);
+ size += sizeof("</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>")
* (poly->nrings - 1);
+
+ size += sizeof("</gml:Polygon>");
+
if ( srs ) size += strlen(srs) + sizeof(" srsName=..");
for (i=0; i<poly->nrings; i++)
@@ -246,14 +252,14 @@
} else {
ptr += sprintf(ptr, "<gml:Polygon>");
}
- ptr += sprintf(ptr, "<gml:OuterBoundaryIs>");
+ ptr += sprintf(ptr,
"<gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>");
ptr += pointArray_toGML(poly->rings[0], ptr);
- ptr += sprintf(ptr, "</gml:OuterBoundaryIs>");
+ ptr += sprintf(ptr,
"</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs>");
for (i=1; i<poly->nrings; i++)
{
- ptr += sprintf(ptr, "<gml:InnerBoundaryIs>");
+ ptr += sprintf(ptr,
"<gml:innerBoundaryIs><gml:LinearRing><gml:coordinates>");
ptr += pointArray_toGML(poly->rings[i], ptr);
- ptr += sprintf(ptr, "</gml:InnerBoundaryIs>");
+ ptr += sprintf(ptr,
"</gml:coordinates></gml:LinearRing></gml:innerBoundaryIs>");
}
ptr += sprintf(ptr, "</gml:Polygon>");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postgis-svn-GML.diff
Type: text/x-patch
Size: 1735 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20070307/b3d5d5f6/attachment.bin>
More information about the postgis-devel
mailing list