private void ValidateMapServiceSpatialReference()
{
// Currently only supporting map services published in 102100
IMapServer3 mapServer = serverObjectHelper.ServerObject as IMapServer3;
if (mapServer == null)
throw new Exception("Unable to access the map server.");
IMapServerInfo mapServerInfo = mapServer.GetServerInfo(mapServer.DefaultMapName);
_spatialReference = mapServerInfo.DefaultMapDescription.SpatialReference;
var wkid = _spatialReference.FactoryCode;
if (wkid != 102100 && wkid != 3857 && wkid != 102113) // All interchangeable, though 102100 should supercede all
{
throw new NotSupportedException(string.Format("WKID {0} is not currently supported. Map service must be in Web Mercator Aux. Sphere (WKID: 102100, 102113, or 3857).", wkid));
}
}