115 size_t prefixlen = strlen(prefix);
119 size = (
sizeof(
"<Box>/") + (prefixlen*2) ) * 2;
120 if ( srs ) size += strlen(srs) +
sizeof(
" srsName=..");
123 ptr = output = v->
data;
125 ptr += sprintf(ptr,
"<%sBox", prefix);
127 if ( srs ) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
129 ptr += sprintf(ptr,
"/>");
149 size += (
sizeof(
"<Box><coordinates>/") + (prefixlen*2) ) * 2;
150 if ( srs ) size += strlen(srs) +
sizeof(
" srsName=..");
153 ptr = output = v->
data;
155 if ( srs ) ptr += sprintf(ptr,
"<%sBox srsName=\"%s\">", prefix, srs);
156 else ptr += sprintf(ptr,
"<%sBox>", prefix);
158 ptr += sprintf(ptr,
"<%scoordinates>", prefix);
160 ptr += sprintf(ptr,
"</%scoordinates></%sBox>", prefix, prefix);
175 size_t prefixlen = strlen(prefix);
180 size = (
sizeof(
"<Envelope>/") + (prefixlen*2) ) * 2;
181 if ( srs ) size += strlen(srs) +
sizeof(
" srsName=..");
184 ptr = output = v->
data;
186 ptr += sprintf(ptr,
"<%sEnvelope", prefix);
187 if ( srs ) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
189 ptr += sprintf(ptr,
"/>");
205 size += (
sizeof(
"<Envelope><lowerCorner><upperCorner>//") + (prefixlen*3) ) * 2;
206 if ( srs ) size += strlen(srs) +
sizeof(
" srsName=..");
207 if (
IS_DIMS(
opts) ) size +=
sizeof(
" srsDimension=. .");
210 ptr = output = v->
data;
212 ptr += sprintf(ptr,
"<%sEnvelope", prefix);
213 if ( srs ) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
214 if (
IS_DIMS(
opts) ) ptr += sprintf(ptr,
" srsDimension=\"%d\"", dimension);
215 ptr += sprintf(ptr,
">");
217 ptr += sprintf(ptr,
"<%slowerCorner>", prefix);
219 ptr += sprintf(ptr,
"</%slowerCorner>", prefix);
227 ptr += sprintf(ptr,
"<%supperCorner>", prefix);
229 ptr += sprintf(ptr,
"</%supperCorner>", prefix);
231 ptr += sprintf(ptr,
"</%sEnvelope>", prefix);
302 size_t prefixlen = strlen(prefix);
305 size += (
sizeof(
"<point><coordinates>/") + (prefixlen*2) ) * 2;
306 if ( srs ) size += strlen(srs) +
sizeof(
" srsName=..");
315 ptr += sprintf(ptr,
"<%sPoint", prefix);
316 if ( srs ) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
319 ptr += sprintf(ptr,
"/>");
322 ptr += sprintf(ptr,
">");
323 ptr += sprintf(ptr,
"<%scoordinates>", prefix);
325 ptr += sprintf(ptr,
"</%scoordinates></%sPoint>", prefix, prefix);
344 size_t prefixlen = strlen(prefix);
347 size += (
sizeof(
"<linestring><coordinates>/") + (prefixlen*2) ) * 2;
348 if ( srs ) size += strlen(srs) +
sizeof(
" srsName=..");
358 ptr += sprintf(ptr,
"<%sLineString", prefix);
359 if ( srs ) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
363 ptr += sprintf(ptr,
"/>");
366 ptr += sprintf(ptr,
">");
368 ptr += sprintf(ptr,
"<%scoordinates>", prefix);
370 ptr += sprintf(ptr,
"</%scoordinates></%sLineString>", prefix, prefix);
390 size_t prefixlen = strlen(prefix);
392 size =
sizeof(
"<polygon></polygon>") + prefixlen*2;
393 if ( srs ) size += strlen(srs) +
sizeof(
" srsName=..");
396 size += (
sizeof(
"<outerboundaryis><linearring><coordinates>/") + ( prefixlen*3) ) * 2;
397 size += (
sizeof(
"<innerboundaryis><linearring><coordinates>/") + ( prefixlen*2) ) * 2 * poly->
nrings;
399 for (i=0; i<poly->
nrings; i++)
412 ptr += sprintf(ptr,
"<%sPolygon", prefix);
413 if ( srs ) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
416 ptr += sprintf(ptr,
"/>");
419 ptr += sprintf(ptr,
">");
420 ptr += sprintf(ptr,
"<%souterBoundaryIs><%sLinearRing><%scoordinates>",
421 prefix, prefix, prefix);
423 ptr += sprintf(ptr,
"</%scoordinates></%sLinearRing></%souterBoundaryIs>", prefix, prefix, prefix);
424 for (i=1; i<poly->
nrings; i++)
426 ptr += sprintf(ptr,
"<%sinnerBoundaryIs><%sLinearRing><%scoordinates>", prefix, prefix, prefix);
428 ptr += sprintf(ptr,
"</%scoordinates></%sLinearRing></%sinnerBoundaryIs>", prefix, prefix, prefix);
430 ptr += sprintf(ptr,
"</%sPolygon>", prefix);
456 size_t prefixlen = strlen(prefix);
460 size =
sizeof(
"<MultiLineString></MultiLineString>");
463 if ( srs ) size += strlen(srs) +
sizeof(
" srsName=..");
465 for (i=0; i<col->
ngeoms; i++)
467 subgeom = col->
geoms[i];
470 size += (
sizeof(
"<pointMember>/") + prefixlen ) * 2;
475 size += (
sizeof(
"<lineStringMember>/") + prefixlen ) * 2;
480 size += (
sizeof(
"<polygonMember>/") + prefixlen ) * 2;
508 ptr += sprintf(ptr,
"<%s%s", prefix, gmltype);
509 if ( srs ) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
513 ptr += sprintf(ptr,
"/>");
516 ptr += sprintf(ptr,
">");
518 for (i=0; i<col->
ngeoms; i++)
520 subgeom = col->
geoms[i];
523 ptr += sprintf(ptr,
"<%spointMember>", prefix);
525 ptr += sprintf(ptr,
"</%spointMember>", prefix);
529 ptr += sprintf(ptr,
"<%slineStringMember>", prefix);
531 ptr += sprintf(ptr,
"</%slineStringMember>", prefix);
535 ptr += sprintf(ptr,
"<%spolygonMember>", prefix);
537 ptr += sprintf(ptr,
"</%spolygonMember>", prefix);
542 ptr += sprintf(ptr,
"</%s%s>", prefix, gmltype);
570 size_t prefixlen = strlen(prefix);
573 size =
sizeof(
"<MultiGeometry></MultiGeometry>");
574 size += (prefixlen * 2);
576 if ( srs ) size += strlen(srs) +
sizeof(
" srsName=..");
578 for (i=0; i<col->
ngeoms; i++)
580 subgeom = col->
geoms[i];
582 size += (
sizeof(
"<geometryMember>/") + prefixlen ) * 2;
600 lwerror(
"asgml2_collection_size: Unable to process geometry type!");
620 ptr += sprintf(ptr,
"<%sMultiGeometry", prefix);
621 if ( srs ) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
625 ptr += sprintf(ptr,
"/>");
628 ptr += sprintf(ptr,
">");
630 for (i=0; i<col->
ngeoms; i++)
632 subgeom = col->
geoms[i];
634 ptr += sprintf(ptr,
"<%sgeometryMember>", prefix);
654 ptr += sprintf(ptr,
"</%sgeometryMember>", prefix);
658 ptr += sprintf(ptr,
"</%sMultiGeometry>", prefix);
698 if ( i ) ptr += sprintf(ptr,
" ");
699 ptr += sprintf(ptr,
"%s,%s",
x,
y);
711 if ( i ) ptr += sprintf(ptr,
" ");
712 ptr += sprintf(ptr,
"%s,%s,%s",
x,
y, z);
788 size_t prefixlen = strlen(prefix);
791 size += (
sizeof(
"<point><pos>/") + (prefixlen*2) ) * 2;
792 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
793 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
794 if (
IS_DIMS(
opts)) size +=
sizeof(
" srsDimension='x'");
806 ptr += sprintf(ptr,
"<%sPoint", prefix);
807 if ( srs ) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
808 if (
id ) ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id);
811 ptr += sprintf(ptr,
"/>");
815 ptr += sprintf(ptr,
">");
816 if (
IS_DIMS(
opts)) ptr += sprintf(ptr,
"<%spos srsDimension=\"%d\">", prefix, dimension);
817 else ptr += sprintf(ptr,
"<%spos>", prefix);
819 ptr += sprintf(ptr,
"</%spos></%sPoint>", prefix, prefix);
839 size_t prefixlen = strlen(prefix);
845 sizeof(
"<LineString><posList>/") +
852 sizeof(
"<Curve><segments><LineStringSegment><posList>/") +
856 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
857 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
858 if (
IS_DIMS(
opts)) size +=
sizeof(
" srsDimension='x'");
873 ptr += sprintf(ptr,
"<%sLineString", prefix);
877 ptr += sprintf(ptr,
"<%sCurve", prefix);
880 if (srs) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
881 if (
id) ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id);
885 ptr += sprintf(ptr,
"/>");
888 ptr += sprintf(ptr,
">");
892 ptr += sprintf(ptr,
"<%ssegments>", prefix);
893 ptr += sprintf(ptr,
"<%sLineStringSegment>", prefix);
898 ptr += sprintf(ptr,
"<%sposList srsDimension=\"%d\">",
903 ptr += sprintf(ptr,
"<%sposList>", prefix);
908 ptr += sprintf(ptr,
"</%sposList>", prefix);
912 ptr += sprintf(ptr,
"</%sLineString>", prefix);
916 ptr += sprintf(ptr,
"</%sLineStringSegment>", prefix);
917 ptr += sprintf(ptr,
"</%ssegments>", prefix);
918 ptr += sprintf(ptr,
"</%sCurve>", prefix);
939 size_t prefixlen = strlen(prefix);
940 size += 2 * (
sizeof(
"<Curve><segments>/" ) + 2 * prefixlen );
941 size += 2 * (
sizeof(
"<ArcString><posList>/" ) + 2 * prefixlen );
942 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
943 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
944 if (
IS_DIMS(
opts)) size +=
sizeof(
" srsDimension='x'");
959 ptr += sprintf(ptr,
"<%sCurve", prefix);
962 ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
966 ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id);
968 ptr += sprintf(ptr,
">");
969 ptr += sprintf(ptr,
"<%ssegments>", prefix);
970 ptr += sprintf(ptr,
"<%sArcString>", prefix);
971 ptr += sprintf(ptr,
"<%sposList", prefix);
975 ptr += sprintf(ptr,
" srsDimension=\"%d\"", dimension);
977 ptr += sprintf(ptr,
">");
980 ptr += sprintf(ptr,
"</%sposList>", prefix);
981 ptr += sprintf(ptr,
"</%sArcString>", prefix);
982 ptr += sprintf(ptr,
"</%ssegments>", prefix);
983 ptr += sprintf(ptr,
"</%sCurve>", prefix);
1007 size_t prefixlen = strlen(prefix);
1010 size = (
sizeof(
"<PolygonPatch><exterior><LinearRing>///") + (prefixlen*3) ) * 2;
1011 size += (
sizeof(
"<interior><LinearRing>//") + (prefixlen*2) ) * 2 * (poly->
nrings - 1);
1012 size += (
sizeof(
"<posList></posList>") + (prefixlen*2) ) * poly->
nrings;
1013 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
1014 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
1017 for (i=0; i<poly->
nrings; i++)
1033 ptr += sprintf(ptr,
"<%sPolygonPatch", prefix);
1038 ptr += sprintf(ptr,
"<%sPolygon", prefix);
1041 if (srs) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
1042 if (
id) ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id);
1046 ptr += sprintf(ptr,
"/>");
1047 return (ptr-output);
1049 ptr += sprintf(ptr,
">");
1051 ptr += sprintf(ptr,
"<%sexterior><%sLinearRing>", prefix, prefix);
1052 if (
IS_DIMS(
opts)) ptr += sprintf(ptr,
"<%sposList srsDimension=\"%d\">", prefix, dimension);
1053 else ptr += sprintf(ptr,
"<%sposList>", prefix);
1056 ptr += sprintf(ptr,
"</%sposList></%sLinearRing></%sexterior>",
1057 prefix, prefix, prefix);
1058 for (i=1; i<poly->
nrings; i++)
1060 ptr += sprintf(ptr,
"<%sinterior><%sLinearRing>", prefix, prefix);
1061 if (
IS_DIMS(
opts)) ptr += sprintf(ptr,
"<%sposList srsDimension=\"%d\">", prefix, dimension);
1062 else ptr += sprintf(ptr,
"<%sposList>", prefix);
1064 ptr += sprintf(ptr,
"</%sposList></%sLinearRing></%sinterior>",
1065 prefix, prefix, prefix);
1067 if (is_patch) ptr += sprintf(ptr,
"</%sPolygonPatch>", prefix);
1068 else ptr += sprintf(ptr,
"</%sPolygon>", prefix);
1070 return (ptr-output);
1095 size_t prefixlen = strlen(prefix);
1097 size = (
sizeof(
"<Curve></Curve>" ) + 2 * prefixlen );
1099 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
1100 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
1102 size += (
sizeof(
"<segments></segments>") + 2 * prefixlen );
1104 for(i= 0; i < col->
ngeoms; ++i )
1106 subgeom = col->
geoms[i];
1110 size +=
sizeof(
"<LineStringSegment></LineStringSegment" ) + 2 * prefixlen;
1111 size +=
sizeof(
"<posList></posList" ) + 2 * prefixlen;
1116 size +=
sizeof(
"<ArcString><posList></ArcString></posList>") + 4 * prefixlen;
1125 size +=
sizeof(
" srsDimension='x'");
1144 ptr += sprintf( ptr,
"<%sCurve", prefix );
1147 ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
1151 ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id );
1153 ptr += sprintf( ptr,
">" );
1154 ptr += sprintf( ptr,
"<%ssegments>", prefix );
1156 for( i = 0; i < col->
ngeoms; ++i )
1158 subgeom = col->
geoms[i];
1166 ptr += sprintf( ptr,
"<%sLineStringSegment><%sposList", prefix, prefix );
1169 ptr += sprintf(ptr,
" srsDimension=\"%d\"", dimension);
1171 ptr += sprintf(ptr,
">");
1173 ptr += sprintf( ptr,
"</%sposList></%sLineStringSegment>", prefix, prefix );
1177 ptr += sprintf( ptr,
"<%sArcString><%sposList" , prefix, prefix );
1180 ptr += sprintf(ptr,
" srsDimension=\"%d\"", dimension);
1182 ptr += sprintf(ptr,
">");
1184 ptr += sprintf( ptr,
"</%sposList></%sArcString>", prefix, prefix );
1188 ptr += sprintf( ptr,
"</%ssegments>", prefix );
1189 ptr += sprintf( ptr,
"</%sCurve>", prefix );
1190 return ( ptr - output );
1205 size_t prefixlen = strlen(prefix);
1207 size_t size =
sizeof(
"<Polygon></Polygon" ) + 2 * prefixlen;
1208 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
1209 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
1212 for( i = 0; i < poly->
nrings; ++i )
1216 size +=
sizeof(
"<exterior></exterior>" ) + 2 * prefixlen;
1220 size +=
sizeof(
"<interior></interior>" ) + 2 * prefixlen;
1222 subgeom = poly->
rings[i];
1226 size +=
sizeof(
"<LinearRing></LinearRing>") + 2 * prefixlen;
1227 size +=
sizeof(
"<posList></posList") + 2 * prefixlen;
1230 size +=
sizeof(
" srsDimension='x'");
1236 size +=
sizeof(
"<Ring></Ring>") + 2 * prefixlen;
1237 size +=
sizeof(
"<CurveMember></CurveMember>") + 2 * prefixlen;
1242 size +=
sizeof(
"<Ring></Ring>") + 2 * prefixlen;
1243 size +=
sizeof(
"<curveMember></curveMember>") + 2 * prefixlen;
1262 ptr += sprintf( ptr,
"<%sPolygon", prefix );
1265 ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
1269 ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id );
1271 ptr += sprintf(ptr,
">");
1273 for( i = 0; i < poly->
nrings; ++i )
1277 ptr += sprintf( ptr,
"<%sexterior>", prefix);
1281 ptr += sprintf( ptr,
"<%sinterior>", prefix);
1284 subgeom = poly->
rings[i];
1287 ptr += sprintf( ptr,
"<%sLinearRing>", prefix );
1288 ptr += sprintf( ptr,
"<%sposList", prefix );
1291 ptr += sprintf(ptr,
" srsDimension=\"%d\"", dimension);
1293 ptr += sprintf( ptr,
">" );
1295 ptr += sprintf( ptr,
"</%sposList>", prefix );
1296 ptr += sprintf( ptr,
"</%sLinearRing>", prefix );
1300 ptr += sprintf( ptr,
"<%sRing>", prefix );
1301 ptr += sprintf( ptr,
"<%scurveMember>", prefix );
1303 ptr += sprintf( ptr,
"</%scurveMember>", prefix );
1304 ptr += sprintf( ptr,
"</%sRing>", prefix );
1308 ptr += sprintf( ptr,
"<%sRing>", prefix );
1309 ptr += sprintf( ptr,
"<%scurveMember>", prefix );
1311 ptr += sprintf( ptr,
"</%scurveMember>", prefix );
1312 ptr += sprintf( ptr,
"</%sRing>", prefix );
1317 ptr += sprintf( ptr,
"</%sexterior>", prefix);
1321 ptr += sprintf( ptr,
"</%sinterior>", prefix);
1325 ptr += sprintf( ptr,
"</%sPolygon>", prefix );
1326 return (ptr - output);
1344 size_t prefixlen = strlen(prefix);
1346 size = (
sizeof(
"<Triangle><exterior><LinearRing>///") + (prefixlen*3) ) * 2;
1347 size +=
sizeof(
"<posList></posList>") + (prefixlen*2);
1348 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
1349 if (
id) size += strlen(prefix) + strlen(
id) +
sizeof(
" id=..");
1350 if (
IS_DIMS(
opts)) size +=
sizeof(
" srsDimension='x'");
1364 ptr += sprintf(ptr,
"<%sTriangle", prefix);
1365 if (srs) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
1366 if (
id) ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id);
1367 ptr += sprintf(ptr,
">");
1369 ptr += sprintf(ptr,
"<%sexterior><%sLinearRing>", prefix, prefix);
1370 if (
IS_DIMS(
opts)) ptr += sprintf(ptr,
"<%sposList srsDimension=\"%d\">", prefix, dimension);
1371 else ptr += sprintf(ptr,
"<%sposList>", prefix);
1374 ptr += sprintf(ptr,
"</%sposList></%sLinearRing></%sexterior>",
1375 prefix, prefix, prefix);
1377 ptr += sprintf(ptr,
"</%sTriangle>", prefix);
1379 return (ptr-output);
1408 size_t prefixlen = strlen(prefix);
1412 size =
sizeof(
"<MultiLineString></MultiLineString>") + prefixlen*2;
1414 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
1415 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
1417 for (i=0; i<col->
ngeoms; i++)
1419 subgeom = col->
geoms[i];
1422 size += (
sizeof(
"<pointMember>/") + prefixlen ) * 2;
1427 size += (
sizeof(
"<curveMember>/") + prefixlen ) * 2;
1432 size += (
sizeof(
"<surfaceMember>/") + prefixlen ) * 2;
1447 char *ptr, *gmltype;
1459 ptr += sprintf(ptr,
"<%s%s", prefix, gmltype);
1460 if (srs) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
1461 if (
id) ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id);
1465 ptr += sprintf(ptr,
"/>");
1466 return (ptr-output);
1468 ptr += sprintf(ptr,
">");
1470 for (i=0; i<col->
ngeoms; i++)
1472 subgeom = col->
geoms[i];
1475 ptr += sprintf(ptr,
"<%spointMember>", prefix);
1477 ptr += sprintf(ptr,
"</%spointMember>", prefix);
1481 ptr += sprintf(ptr,
"<%scurveMember>", prefix);
1483 ptr += sprintf(ptr,
"</%scurveMember>", prefix);
1487 ptr += sprintf(ptr,
"<%ssurfaceMember>", prefix);
1489 ptr += sprintf(ptr,
"</%ssurfaceMember>", prefix);
1494 ptr += sprintf(ptr,
"</%s%s>", prefix, gmltype);
1496 return (ptr-output);
1518 size_t prefixlen = strlen(prefix);
1520 size = (
sizeof(
"<PolyhedralSurface><polygonPatches>/") + prefixlen*2) * 2;
1521 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
1522 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
1524 for (i=0; i<psur->
ngeoms; i++)
1545 ptr += sprintf(ptr,
"<%sPolyhedralSurface", prefix);
1546 if (srs) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
1547 if (
id) ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id);
1548 ptr += sprintf(ptr,
"><%spolygonPatches>", prefix);
1550 for (i=0; i<psur->
ngeoms; i++)
1556 ptr += sprintf(ptr,
"</%spolygonPatches></%sPolyhedralSurface>",
1559 return (ptr-output);
1581 size_t prefixlen = strlen(prefix);
1583 size = (
sizeof(
"<Tin><trianglePatches>/") + prefixlen*2) * 2;
1584 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
1585 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
1587 for (i=0; i<tin->
ngeoms; i++)
1608 ptr += sprintf(ptr,
"<%sTin", prefix);
1609 if (srs) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
1610 if (
id) ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id);
1611 else ptr += sprintf(ptr,
"><%strianglePatches>", prefix);
1613 for (i=0; i<tin->
ngeoms; i++)
1620 ptr += sprintf(ptr,
"</%strianglePatches></%sTin>", prefix, prefix);
1622 return (ptr-output);
1643 size_t prefixlen = strlen(prefix);
1646 size =
sizeof(
"<MultiGeometry></MultiGeometry>") + prefixlen*2;
1648 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
1649 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
1651 for (i=0; i<col->
ngeoms; i++)
1653 subgeom = col->
geoms[i];
1654 size += (
sizeof(
"<geometryMember>/") + prefixlen ) * 2;
1672 lwerror(
"asgml3_collection_size: unknown geometry type");
1688 ptr += sprintf(ptr,
"<%sMultiGeometry", prefix);
1689 if (srs) ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
1690 if (
id) ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id);
1694 ptr += sprintf(ptr,
"/>");
1695 return (ptr-output);
1697 ptr += sprintf(ptr,
">");
1699 for (i=0; i<col->
ngeoms; i++)
1701 subgeom = col->
geoms[i];
1702 ptr += sprintf(ptr,
"<%sgeometryMember>", prefix);
1723 lwerror(
"asgml3_collection_buf: unknown geometry type");
1725 ptr += sprintf(ptr,
"</%sgeometryMember>", prefix);
1729 ptr += sprintf(ptr,
"</%sMultiGeometry>", prefix);
1731 return (ptr-output);
1749 size_t prefixlen = strlen(prefix);
1750 size_t size =
sizeof(
"<MultiCurve></MultiCurve>" ) + 2 * prefixlen;
1751 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
1752 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
1756 for( i = 0; i <
cur->ngeoms; ++i )
1758 size +=
sizeof(
"<curveMember></curveMember>" ) + 2 * prefixlen;
1759 subgeom =
cur->geoms[i];
1782 ptr += sprintf(ptr,
"<%sMultiCurve", prefix );
1785 ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
1789 ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id );
1791 ptr += sprintf( ptr,
">");
1793 for( i = 0; i <
cur->ngeoms; ++i )
1795 ptr += sprintf(ptr,
"<%scurveMember>", prefix );
1796 subgeom =
cur->geoms[i];
1809 ptr += sprintf(ptr,
"</%scurveMember>", prefix );
1811 ptr += sprintf(ptr,
"</%sMultiCurve>", prefix );
1812 return (ptr - output);
1827 size_t prefixlen = strlen(prefix);
1828 size_t size =
sizeof(
"<MultiSurface></MultiSurface>" ) + 2 * prefixlen;
1829 if (srs) size += strlen(srs) +
sizeof(
" srsName=..");
1830 if (
id) size += strlen(
id) + strlen(prefix) +
sizeof(
" id=..");
1834 for( i = 0; i < sur->
ngeoms; ++i )
1836 subgeom = sur->
geoms[i];
1855 ptr += sprintf( ptr,
"<%sMultiSurface", prefix );
1858 ptr += sprintf(ptr,
" srsName=\"%s\"", srs);
1862 ptr += sprintf(ptr,
" %sid=\"%s\"", prefix,
id );
1864 ptr += sprintf( ptr,
">" );
1866 for( i = 0; i < sur->
ngeoms; ++i )
1868 subgeom = sur->
geoms[i];
1878 ptr += sprintf( ptr,
"</%sMultiSurface>", prefix );
1879 return ptr - output;
1916 if ( i ) ptr += sprintf(ptr,
" ");
1918 ptr += sprintf(ptr,
"%s %s",
y,
x);
1920 ptr += sprintf(ptr,
"%s %s",
x,
y);
1933 if ( i ) ptr += sprintf(ptr,
" ");
1935 ptr += sprintf(ptr,
"%s %s %s",
y,
x, z);
1937 ptr += sprintf(ptr,
"%s %s %s",
x,
y, z);
int ptarray_remove_point(POINTARRAY *pa, uint32_t where)
Remove a point from an existing POINTARRAY.
#define LW_GML_SHORTLINE
For GML3, use <LineString> rather than <Curve> for lines.
#define POINTTYPE
LWTYPE numbers, used internally by PostGIS.
#define FLAGS_GET_Z(flags)
#define FLAGS_NDIMS(flags)
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
#define POLYHEDRALSURFACETYPE
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
const char * lwtype_name(uint8_t type)
Return the type name string associated with a type number (e.g.
void ptarray_free(POINTARRAY *pa)
const GBOX * lwgeom_get_bbox(const LWGEOM *lwgeom)
Get a non-empty geometry bounding box, computing and caching it if not already there.
#define LWSIZE_SET(varsize, len)
int ptarray_append_point(POINTARRAY *pa, const POINT4D *pt, int allow_duplicates)
Append a point to the end of an existing POINTARRAY If allow_duplicate is LW_FALSE,...
void * lwalloc(size_t size)
#define LW_TRUE
Return types for functions with status returns.
This library is the generic geometry handling section of PostGIS.
int lwline_is_empty(const LWLINE *line)
#define OUT_MAX_BYTES_DOUBLE
#define OUT_DOUBLE_BUFFER_SIZE
int lwpoint_is_empty(const LWPOINT *point)
int lwpoly_is_empty(const LWPOLY *poly)
int lwprint_double(double d, int maxdd, char *buf)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static const POINT2D * getPoint2d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT2D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static const POINT3D * getPoint3d_cp(const POINTARRAY *pa, uint32_t n)
Returns a POINT3D pointer into the POINTARRAY serialized_ptlist, suitable for reading from.
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
static size_t asgml3_multisurface_size(const LWMSURFACE *sur, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml2_multi_size(const LWCOLLECTION *col, const char *srs, int precision, const char *prefix)
static size_t asgml2_point_size(const LWPOINT *point, const char *srs, int precision, const char *prefix)
static lwvarlena_t * asgml2_point(const LWPOINT *point, const char *srs, int precision, const char *prefix)
static size_t pointArray_toGML3(POINTARRAY *pa, char *buf, int precision, int opts)
static lwvarlena_t * asgml2_collection(const LWCOLLECTION *col, const char *srs, int precision, const char *prefix)
static lwvarlena_t * gbox_to_gml2(const GBOX *bbox, const char *srs, int precision, const char *prefix)
static lwvarlena_t * asgml3_multi(const LWCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml3_multicurve(const LWMCURVE *cur, const char *srs, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml3_collection(const LWCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_curvepoly_buf(const LWCURVEPOLY *poly, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml3_circstring(const LWCIRCSTRING *circ, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_poly_size(const LWPOLY *poly, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_psurface_buf(const LWPSURFACE *psur, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml3_line(const LWLINE *line, const char *srs, int precision, int opts, const char *prefix, const char *id)
lwvarlena_t * lwgeom_to_gml2(const LWGEOM *geom, const char *srs, int precision, const char *prefix)
VERSION GML 2 takes a GEOMETRY and returns a GML2 representation.
static lwvarlena_t * asgml3_compound(const LWCOMPOUND *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml2_line(const LWLINE *line, const char *srs, int precision, const char *prefix)
static size_t asgml3_point_size(const LWPOINT *point, const char *srs, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml3_triangle(const LWTRIANGLE *triangle, const char *srs, int precision, int opts, const char *prefix, const char *id)
lwvarlena_t * lwgeom_extent_to_gml3(const LWGEOM *geom, const char *srs, int precision, int opts, const char *prefix)
lwvarlena_t * lwgeom_extent_to_gml2(const LWGEOM *geom, const char *srs, int precision, const char *prefix)
static size_t asgml3_line_size(const LWLINE *line, const char *srs, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml3_tin(const LWTIN *tin, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml2_collection_size(const LWCOLLECTION *col, const char *srs, int precision, const char *prefix)
static size_t asgml3_circstring_size(const LWCIRCSTRING *circ, const char *srs, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml2_multi(const LWCOLLECTION *col, const char *srs, int precision, const char *prefix)
static size_t asgml3_collection_size(const LWCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_multi_buf(const LWCOLLECTION *col, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_circstring_buf(const LWCIRCSTRING *circ, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static size_t pointArray_GMLsize(POINTARRAY *pa, int precision)
static size_t asgml3_multicurve_buf(const LWMCURVE *cur, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * gbox_to_gml3(const GBOX *bbox, const char *srs, int precision, int opts, const char *prefix)
static size_t asgml2_poly_buf(const LWPOLY *poly, const char *srs, char *output, int precision, const char *prefix)
static size_t asgml3_multisurface_buf(const LWMSURFACE *sur, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_compound_buf(const LWCOMPOUND *col, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml2_poly(const LWPOLY *poly, const char *srs, int precision, const char *prefix)
static size_t asgml3_triangle_size(const LWTRIANGLE *triangle, const char *srs, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml3_curvepoly(const LWCURVEPOLY *poly, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_multicurve_size(const LWMCURVE *cur, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_compound_size(const LWCOMPOUND *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_psurface_size(const LWPSURFACE *psur, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml2_multi_buf(const LWCOLLECTION *col, const char *srs, char *output, int precision, const char *prefix)
static lwvarlena_t * asgml3_poly(const LWPOLY *poly, const char *srs, int precision, int opts, int is_patch, const char *prefix, const char *id)
static size_t asgml2_line_size(const LWLINE *line, const char *srs, int precision, const char *prefix)
static size_t asgml3_collection_buf(const LWCOLLECTION *col, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_tin_buf(const LWTIN *tin, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static size_t asgml2_point_buf(const LWPOINT *point, const char *srs, char *output, int precision, const char *prefix)
static size_t asgml3_line_buf(const LWLINE *line, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_point_buf(const LWPOINT *point, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_poly_buf(const LWPOLY *poly, const char *srs, char *output, int precision, int opts, int is_patch, const char *prefix, const char *id)
static size_t asgml3_triangle_buf(const LWTRIANGLE *triangle, const char *srs, char *output, int precision, int opts, const char *prefix, const char *id)
static size_t asgml3_multi_size(const LWCOLLECTION *col, const char *srs, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml3_point(const LWPOINT *point, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml2_line_buf(const LWLINE *line, const char *srs, char *output, int precision, const char *prefix)
static size_t asgml2_poly_size(const LWPOLY *poly, const char *srs, int precision, const char *prefix)
static size_t asgml3_curvepoly_size(const LWCURVEPOLY *poly, const char *srs, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml3_multisurface(const LWMSURFACE *sur, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t asgml2_collection_buf(const LWCOLLECTION *col, const char *srs, char *output, int precision, const char *prefix)
static size_t asgml3_tin_size(const LWTIN *tin, const char *srs, int precision, int opts, const char *prefix, const char *id)
static lwvarlena_t * asgml3_psurface(const LWPSURFACE *psur, const char *srs, int precision, int opts, const char *prefix, const char *id)
lwvarlena_t * lwgeom_to_gml3(const LWGEOM *geom, const char *srs, int precision, int opts, const char *prefix, const char *id)
static size_t pointArray_toGML2(POINTARRAY *pa, char *buf, int precision)