| |
int first_last_point = 0;
string server = "ip";
ESRI.ArcGIS.ADF.Identity ident =
new ESRI.ArcGIS.ADF.Identity("user", "pswd", "domain");
ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection connection =
new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection(server,ident);
connection.Connect();
if (!connection.IsConnected) { throw new Exception("Unable to connect to server '" + server + "', make sure an ArcGIS Identity has been set."); }
ESRI.ArcGIS.Server.IServerContext sc;
sc = connection.ServerObjectManager.CreateServerContext("mapservice", "MapServer");
ISpatialReferenceFactory2 pSpRFc1 = (ISpatialReferenceFactory2)
sc.CreateObject("esriGeometry.SpatialReferenceEnvironment");
IProjectionGEN pProjection = (IProjectionGEN)pSpRFc1.CreateProjection(
(int)esriSRProjectionType.esriSRProjection_TransverseMercator);
ILinearUnit pUnit = //(ILinearUnit)sc.CreateObject("esriGeometry.LinearUnit");
(ILinearUnit)pSpRFc1.CreateUnit((int)esriSRUnitType.esriSRUnit_Meter);
IParameter[] aParamArray = pProjection.GetDefaultParameters();
aParamArray[0].Value = 2300000.00;
aParamArray[1].Value = -200.00;
aParamArray[2].Value = 52.033;
aParamArray[4].Value = 0.083;
aParamArray[3].Value = 1.0;
IProjectedCoordinateSystem pProjCoordSys = (IProjectedCoordinateSystem)
sc.CreateObject("esriGeometry.ProjectedCoordinateSystem");
IProjectedCoordinateSystemEdit pProjCoordSysEdit =
(IProjectedCoordinateSystemEdit)pProjCoordSys;
IGeographicCoordinateSystem pGCS1 = pSpRFc1.CreateGeographicCoordinateSystem
((int)esriSRGeoCSType.esriSRGeoCS_Pulkovo1942);
//IProjectedCoordinateSystemEdit pProjCoordSysEdit;
object oname = "Transverse_Mercator";
object name = "Transverse_Mercator";
object alias = "Trans_Merc";
object abbreviation = "TM";
object remarks = "This PCS is Transverse Mercator";
object useage = "When making maps of Tatarstan";
object opGCS1 = pGCS1;// as object;
object opUnit = pUnit; //as object;
object opProjection = pProjection;// as object;
object oaParamArray = aParamArray;// as object;
//error!!!
pProjCoordSysEdit.Define(
ref oname, ref alias, ref abbreviation, ref remarks, ref useage, ref opGCS1,
ref opUnit, ref opProjection, ref oaParamArray);
|