Representation of Geometry

MapGuide can represent geometric data in three different forms:

- AGF text format, which is an extension of the Open Geospatial Consortium (OGC) Well Known Text (WKT) format. This is used to represent geometry as a character string.
- Binary AGF format. This is used by the FDO technology supporting the Feature Service.
- MapGuide internal representation, using MgGeometry and classes derived from it.

NoteThis guide and the Web API Reference will often use the term WKT to mean AGF text format. Be aware that AGF Text values do not always conform to the OGC WKT standard. See the Geometry module in the Web API Reference for details.

To convert between AGF text and the MapGuide internal representation, use an MgWktReaderWriter object. Call MgWktReaderWriter.Read() to convert AGF text to MgGeometry. Call MgWktReaderWriter.Write() to convert MgGeometry to AGF text.

To convert between binary AGF and the MapGuide internal representation, use an MgAgfReaderWriter object. Call MgAgfReaderWriter.Read() to convert binary AGF to MgGeometry. Call MgAgfReaderWriter.Write() to convert MgGeometry to binary AGF.

For example, if you have a WKT representation of the geometry, you could create a geometry object as follows:

    MgWktReaderWriter wktReaderWriter = new MgWktReaderWriter();

    MgGeometry geometry = wktReaderWriter.Read(wktGeometry);

#### Topics in this section

- Geometry Objects
- Comparing Geometry Objects