MapGuide RFC 44 - Specific Geometry Types in Property Definition

This page contains a change request (RFC) for the MapGuide Open Source project. More MapGuide RFCs can be found on the RFCs page.


RFC Template Version(1.0)
Submission Date2007dec20
Last ModifiedGavin Cramer Timestamp
AuthorGavin Cramer
RFC Statusadopted
Implementation Statuspending
Proposed Milestone2.0
Assigned PSC guide(s)Tom
Voting History(vote date)
+1Tom, Paul, Bruce, Jason, Andy


The geometric property definition only describes geometry types grouped by their shape’s dimensionality. In order to successfully persist data to some providers with more specific restrictions (e.g. SHP), the undiluted list of geometric types is required. This has already been done in the FDO API. This RFC proposes to offer the same via MapGuide API.


The current API describes the allowed geometry types via MgGeometricPropertyDefinition::GetGeometryTypes, which returns a bit-mask value composed of values from the MgFeatureGeometricType enumeration. The allowed values pertain to the shape dimensionality (Point, Curve, Surface or Solid), rather than to specific geometry types as described by MgGeometryType (Point, LineString, CurveString, Polygon, etc.). Some FDO Providers restrict the type of geometry in a geometric property to a specific. SHP is a good example of this. The provider may advertise that the geometry can be a Curve, which implies LineString, MultiLineString, CurveString, and MultiCurveString. However, the provider might only allow LineString in this case. If an attempt is made to insert a MultiLineString geometry, an exception is thrown that it cannot be written. A more fine grained specification of allowed geometry types will avoid these situations because the caller can check specific types beforehand. FDO supports the needed check via the FdoGeometricPropertyDefinition::GetSpecificGeometryTypes method, and its counterpart, SetSpecificGeometryTypes. These more specific method were never added to the corresponding GIS Platform class, MgGeometricPropertyDefinition. This RFC proposes to add the same methods to the Platform.

Proposed Solution

Add the following class to contain the accessor’s results (in lieu of the FDO method’s use of an output parameter):


class MG_PLATFORMBASE_API MgGeometryTypeInfo : public MgSerializable
    MgGeometryType GetType(INT32 index);
    INT32 GetCount();

    virtual INT32 GetClassId();
    virtual void Serialize(MgStream* stream);
    virtual void Deserialize(MgStream* stream);
    virtual void ToXml(string &str);
    virtual void SetTypes(MgGeometryType * types, INT32 count);

    virtual void Dispose();

    MgGeometryType m_types[MAX_GEOMETRY_TYPE_SIZE];
    INT32          m_count;

    static const INT32 m_cls_id = PlatformBase_FeatureService_GeometryTypeInfo;

Add the following methods to the PUBLISHED_API section of MgGeometricPropertyDefinition. Descriptions are adapted from the FDO API version for brevity.

    /// \brief
    /// Gets the specific geometry types that can be stored in this geometric
    /// property. The returned value is a list of geometry types that are
    /// supported.  The caller does NOT own the array of types and should not free its memory.
    /// \return
    /// Returns a list of geometry types that are supported.
    MgGeometryTypeInfo * GetSpecificGeometryTypes();

    /// \brief
    /// Sets the specific set of geometry types that can be stored in this
    /// geometric property. The provided value is a list of geometry types
    /// that are supported. 
    /// \param typeInfo
    /// The specific set of geometry types that can be stored in this
    /// geometric property.
    /// \return
    /// Returns nothing.
    void SetSpecificGeometryTypes(MgGeometryTypeInfo * typeInfo);

Defaults will be applied as appropriate when the older SetGeometryTypes method is used. The MgFeatureGeometricType --> MgGeometryType mappings are:

  • Point --> Point and MultiPoint
  • Curve --> LineString, MultiLineString, CurveString, MultiCurveString
  • Surface --> Polygon, MultiPolygon, CurvePolygon, MultiCurvePolygon
  • Solid --> (none)
  • All --> All types above, plus MultiGeometry.


This is strictly an API change.

Test Plan

  • Add unit tests which test the new API methods.


Autodesk to supply the resources to make the required changes.

Last modified 16 years ago Last modified on Jan 12, 2008, 7:40:54 PM
Note: See TracWiki for help on using the wiki.