The OSGeo.MapGuide namespace contains a set of classes which provide access to the CS-Map coordinate system functionality in both the AutoCAD Map 3D and AIMS environments.
MgCoordinateSystemFactory is used to get the coordinate system categories and the coordinate system catalog. MgCoordinateSystemCatalog is used to get the various dictionaries. MgCoordinateSystemDictionary contains definitions for earth-based and Euclidean coordinate systems.
The following code extracts all of the coordinate system names from the coordinate system dictionary, uses those names to get all of the coordinate system definitions from the dictionary and determines the type (projected, geographic, or arbitrary) of the coordinate system from its definition, and stores the name of the coordinate system in a list according to its type.
//MgCoordinateSystemFactory coordSysFactory = new MgCoordinateSystemFactory();
//MgCoordinateSystemCatalog csCatalog = coordSysFactory.GetCatalog();
//MgCoordinateSystemDictionary csDict = csCatalog.GetCoordinateSystemDictionary();
List<string> arbitraryCs = new List<string>();
List<string> geographicCs = new List<string>();
List<string> projectedCs = new List<string>();
MgCoordinateSystemEnum csDictEnum = csDict.GetEnum();
// the following line gets all of the names in the dictionary
// uses those names to get the coordinate
int csCount = csDict.GetSize();
ed.WriteMessage("\nCoordinate System Count : " + csCount.ToString());
ed.WriteMessage("\n-------------------------------------------------");
MgStringCollection csNames = csDictEnum.NextName(csCount);
string csName = null;
MgCoordinateSystem cs = null;
int csType = 0;
for (int i = 0; i < csCount; i++)
{
csName = csNames.GetItem(i);
cs = csDict.GetCoordinateSystem(csName);
csType = cs.GetType();
if (csType == MgCoordinateSystemType.Arbitrary)
{
arbitraryCs.Add(csName);
}
else if (csType == MgCoordinateSystemType.Geographic)
{
geographicCs.Add(csName);
}
else if (csType == MgCoordinateSystemType.Projected)
{
projectedCs.Add(csName);
}
ed.WriteMessage("\nCoordinate System Name : " + csName.ToString());
}
Hope this is useful to you !