Thomas
July 24, 2010, 2:07pm
1
Hello ThinkGeo-Team,
what I need is a method that return the MapUnit I have to set to the Map-Control depending on SRID information. In our application the user can define the target SRID all the layers have projected to. Depending on the SRID I have to set the MapUnit for Map-Control to meter or decimal degree.
Is it possible to receive the MapUnit for Map-Control from parameter string of SRID?
Any suggestions?
Thomas,
I wrote an API for you; just take a try if you want: private static GeographyUnit GetGeographyUnitCore(string projectionString) { GeographyUnit geographyUnit = GeographyUnit.Unknown; if (string.IsNullOrEmpty(projectionString)) { throw new ArgumentException("Parameter is not valid."); } else if (projectionString.IndexOf("units=m", StringComparison.OrdinalIgnoreCase) != -1) { geographyUnit = GeographyUnit.Meter; } else if (projectionString.IndexOf("to_meter=0.3", StringComparison.OrdinalIgnoreCase) != -1) { geographyUnit = GeographyUnit.Feet; } else if (projectionString.IndexOf("to_meter=", StringComparison.OrdinalIgnoreCase) == -1) { geographyUnit = GeographyUnit.DecimalDegree; } if (geographyUnit == GeographyUnit.Unknown) { throw new ArgumentException("String is not correct."); } return geographyUnit; } Any more questions just feel free to let me know. Thanks. Yale
Thomas
July 26, 2010, 1:24am
3
Hello Yale, thanks for your code. This is what i need. Thomas
Thomas, OK, Thanks for letting me know your status. Any more questions just feel free to let me know. Thanks. Yale