Web API Reference | MapGuide Open Source

- Overview
- Modules
- Classes

# AGF Text
[Geometry]

## Summary

A geometry can be specified in a string using a grammar called AGF Text, which is a superset of the Open GIS Consortium's (OGC ) Well-Known-Text (WKT) grammar. The OGC WKT grammar is defined in the OpenGIS Project Document 99-049, "OpenGIS Simple Features Specification For SQL", Revision 1.1.

AGF Text is a superset of WKT. AGF Text adds definitions for CurveString, MultiCurveString, CurvePolygon, and MultiCurvePolygon and dimensionality attribute for each definition.

## Notes regarding the AGF Text Grammar

- Productions in this grammar do not contain tabs or newlines.

- If the <Dimensionality> is XY, it may be omitted.

- A DOUBLE is a double precision floating point value. In the input an integer may be substituted for a DOUBLE, but the lexical analyzer will convert the integer to a DOUBLE.

- A <LineString> is closed if the first and last <Point>s in its <PointCollection> are identical.

- The first <LineString> in the <LineStringCollection> of a <Polygon> is the exterior boundary of the polygon, and subsequent <LineString>s in the collection are inside of it. All of the <LineString>s in the collection are closed.

- The initial <Point> of a <CurveSegment> is the initial <Point> of a <CurveString> or the last <Point> of a <CurveSegment> preceding it in a <CurveSegmentCollection>.

- A <CurveString> is closed if the initial <Point> is identical to the last <Point> in the last <CurveSegment> of the <CurveSegmentCollection>.

- The first <CurveString> in the <CurveStringCollection> of a <CurvePolygon> is the exterior boundary of the polygon, and subsequent <CurveString>s in the collection are inside of it. All of the <CurveString>s in the collection are closed.

## AGF Text Grammar

`<AGF Text> ::= POINT <Dimensionality> <PointEntity>
| LINESTRING <Dimensionality> <LineString>
| POLYGON <Dimensionality> <Polygon>
| CURVESTRING <Dimensionality> <CurveString>
| CURVEPOLYGON <Dimensionality> <CurvePolygon>
| MULTIPOINT <Dimensionality> <MultiPoint>
| MULTILINESTRING <Dimensionality> <MultiLineString>
| MULTIPOLYGON <Dimensionality> <MultiPolygon>
| MULTICURVESTRING <Dimensionality> <MultiCurveString>
| MULTICURVEPOLYGON <Dimensionality> <MultiCurvePolygon>
| GEOMETRYCOLLECTION <GeometryCollection>
<PointEntity> ::= '(' <Point> ')'
<LineString> ::= '(' <PointCollection> ')'
<Polygon> ::= '(' <LineStringCollection> ')'
<MultiPoint> ::= '(' <PointCollection> ')'
<MultiLineString> ::= '(' <LineStringCollection> ')'
<MultiPolygon> ::= '(' <PolygonCollection> ')'
<GeometryCollection : '(' <AGF Collection Text> ')'
<CurveString> ::= '(' <StartPoint> '('
<CurveSegmentCollection> ')' ')'
<CurvePolygon> ::= '(' <CurveStringCollection> ')'
<MultiCurveString> ::= '(' <CurveStringCollection> ')'
<MultiCurvePolygon> ::= '(' <CurvePolygonCollection> ')'
<Dimensionality> ::= // default to XY
| XY
| XYZ
| XYM
| XYZM
<Point> ::= DOUBLE DOUBLE
| DOUBLE DOUBLE DOUBLE
| DOUBLE DOUBLE DOUBLE DOUBLE
<StartPoint> ::= <Point>
<2ndPoint> ::= <Point>
<EndAndStartPointNextSeg> ::= <Point>
<PointCollection> ::= <Point>
| <PointCollection ',' <Point>
<LineStringCollection> ::= <LineString>
| <LineStringCollection> ',' <LineString>
<PolygonCollection> ::= <Polygon>
| <PolygonCollection> ',' <Polygon>
<AGF Collection Text> ::= <AGF Text>
| <AGF Collection Text> ',' <AGF Text>
<CurveSegment> ::= CIRCULARARCSEGMENT '(' <2ndPoint> ','
<EndAndStartPointNextSeg> ')'
| LINESTRINGSEGMENT '(' <LineSegmentPointCollection> ')'
<LineSegmentPointCollection> ::= <EndAndStartPointNextSeg>
| <2ndPoint>, <EndAndStartPointNextSeg>
| <2ndPoint>, <PointCollection>,
<EndAndStartPointNextSeg>
<CurveSegmentCollection> ::= <CurveSegment>
| <CurveSegmentCollection> ',' <CurveSegment>
<CurveStringCollection> ::= <CurveString>
| <CurveStringCollection> ',' <CurveString>
<CurvePolygonCollection> ::= <CurvePolygon>
| <CurvePolygonCollection> ',' <CurvePolygon>`

## Examples

Each example is shown in two formats. The first format conforms to the grammar, and the second format contains tabs and newlines to make the structure of the production more comprehensible.

POINT XY (0 0)

    POINT XY (
       0 0
    )

MULTIPOINT XY (0 0 , 1 1)

    MULTIPOINT XY (
       0 0 , 1 1
    )

LINESTRING XY (0 0 , 1 -1)

    LINESTRING XY(
       0 0 , 1 -1
    )

MULTILINESTRING XY ((3 -2, 4 -2), (5 -2, 6 -2))

    MULTILINESTRING XY (
       ( 3 -2, 4 -2 ),
       ( 5 -2, 6 -2 )
    )

POLYGON XY ((1 -3, 4 -3, 4 -6, 1 -6, 1 -3), (2 -4, 3 -4, 3 -5, 2 -5, 2 -4))

    POLYGON XY (
       (1 -3, 4 -3, 4 -6, 1 -6, 1 -3),
       (2 -4, 3 -4, 3 -5, 2 -5, 2 -4)
    )

MULTIPOLYGON XY (((5 -3, 8 -3, 8 -6, 5 -6, 5 -3), (6 -4, 7 -4, 7 -5, 6 -5, 6 -4)), ((9 -3, 12 -3, 12 -6, 9 -6, 9 -3), (10 -4, 11 -4, 11 -5, 10 -5, 10 -4)))

    MULTIPOLYGON XY (
       (
          (5 -3, 8 -3, 8 -6, 5 -6, 5 -3),
          (6 -4, 7 -4, 7 -5, 6 -5, 6 -4)
       ),
       (
          (9 -3, 12 -3, 12 -6, 9 -6, 9 -3),
          (10 -4, 11 -4, 11 -5, 10 -5, 10 -4)
       )
    )

CURVESTRING XY (0 -9 (CIRCULARARCSEGMENT(2 -7, 4 -9), LINESTRINGSEGMENT(2 5, 6 9, 4 2)))

    CURVESTRING XY (
       0 -9 (
          CIRCULARARCSEGMENT(2 -7, 4 -9),
          LINESTRINGSEGMENT(2 5, 6 9, 4 2)
       )
    )

MULTICURVESTRING XY (( 5 -9 ( LINESTRINGSEGMENT(7 -7, 9 -9), LINESTRINGSEGMENT(11 -7, 13 -9))), ( 10 -9 ( CIRCULARARCSEGMENT(12 -7, 14 -9) CIRCULARARCSEGMENT(16 -4, 17 -8))))

    MULTICURVESTRING XY (
       (
          5 -9 (
             LINESTRINGSEGMENT(7 -7, 9 -9),
             LINESTRINGSEGMENT(11 -7, 13 -9)
          )
       ),
       (
          10 -9 (
             CIRCULARARCSEGMENT(12 -7, 14 -9)
             CIRCULARARCSEGMENT(16 -4, 17 -8)
          )
       )
    )

CURVEPOLYGON XY (( 0 -13 (CIRCULARARCSEGMENT( 2 -11, 4 -13), CIRCULARARCSEGMENT( 2 -15, 0 -13))), ( 1 -13 ( CIRCULARARCSEGMENT( 2 -12, 3 -13), CIRCULARARCSEGMENT( 2 -14, 1 -13))))

    CURVEPOLYGON XY (
       (
          0 -13 (
             CIRCULARARCSEGMENT( 2 -11, 4 -13),
             CIRCULARARCSEGMENT( 2 -15, 0 -13)
          )
       ),
       (
          1 -13 (
             CIRCULARARCSEGMENT( 2 -12, 3 -13),
             CIRCULARARCSEGMENT( 2 -14, 1 -13)
          )
       )
    )

MULTICURVEPOLYGON XY ((( 5 -13 ( CIRCULARARCSEGMENT( 7 -11, 9 -13), CIRCULARARCSEGMENT( 7 -15, 5 -13))), (6 -13 ( CIRCULARARCSEGMENT( 7 -12, 8 -13), CIRCULARARCSEGMENT( 7 -14, 6 -13)))), (( 10 -13 ( CIRCULARARCSEGMENT( 12 -11, 14 -13), CIRCULARARCSEGMENT( 12 -15, 10 -13))), (11 -13 ( CIRCULARARCSEGMENT( 12 -12, 13 -13), CIRCULARARCSEGMENT( 12 -14, 11 -13)))))

    MULTICURVEPOLYGON XY (
       (
          (
             5 -13 (
                CIRCULARARCSEGMENT( 7 -11, 9 -13),
                CIRCULARARCSEGMENT( 7 -15, 5 -13)
             )
          ),
          (
             6 -13 (
                CIRCULARARCSEGMENT( 7 -12, 8 -13),
                CIRCULARARCSEGMENT( 7 -14, 6 -13)
             )
          )
       ),
       (
          (
             10 -13 (
                CIRCULARARCSEGMENT( 12 -11, 14 -13),
                CIRCULARARCSEGMENT( 12 -15, 10 -13)
             )
          ),
          (
             11 -13 (
                CIRCULARARCSEGMENT( 12 -12, 13 -13),
                CIRCULARARCSEGMENT( 12 -14, 11 -13)
             )
          )
       )
    )

Comments or suggestions? Send us feedback.