Exemplo n.º 1
0
    public string CreateService10_1(string sConnectionToSDEorGDB,
                              string sArcGisServer,
                              string sServiceName,
                              string sMxdTemplate,
                              bool bSde,
                              string MxdOutput,
                              string agsConnection,
                              string sPythonScriptDir)
    {

      ServicePublisher.MXD.PublishMXD pPublishMxd;
      try
      {
        //Use mxd on file
        // Template found at c:\inetput\wwwroot\osm\Mxds\OSMTemplate.mxd
        //OSMTemplate.mxd in source control

        string sDataSet = sConnectionToSDEorGDB.Substring(sConnectionToSDEorGDB.LastIndexOf("\\") + 1);

        if (!(bSde))
        {
          sConnectionToSDEorGDB = sConnectionToSDEorGDB.Substring(0, sConnectionToSDEorGDB.Length - (sConnectionToSDEorGDB.Length - sConnectionToSDEorGDB.LastIndexOf("\\") + 1));
        }
        else
        {
          sConnectionToSDEorGDB = sConnectionToSDEorGDB.Substring(0, sConnectionToSDEorGDB.Length - (sConnectionToSDEorGDB.Length - sConnectionToSDEorGDB.LastIndexOf("\\")));
        }

        string sMxdOutputDir = MxdOutput;

        
        pPublishMxd = new MXD.PublishMXD(sMxdTemplate, sArcGisServer, sServiceName, sConnectionToSDEorGDB, sDataSet, sMxdOutputDir, bSde);
        return pPublishMxd.Publish(agsConnection, sPythonScriptDir);
      }
      catch (Exception ex)
      {
        throw ex;
      }
      finally
      {
        pPublishMxd = null;
      }
    }
Exemplo n.º 2
0
        public string CreateService10_1(string sConnectionToSDEorGDB,
                                        string sArcGisServer,
                                        string sServiceName,
                                        string sMxdTemplate,
                                        bool bSde,
                                        string MxdOutput,
                                        string agsConnection,
                                        string sPythonScript)
        {
            ServicePublisher.MXD.PublishMXD pPublishMxd;
            try
            {
                //Use mxd on file
                // Template found at c:\inetput\wwwroot\osm\Mxds\OSMTemplate.mxd
                //OSMTemplate.mxd in source control

                string sDataSet = sConnectionToSDEorGDB.Substring(sConnectionToSDEorGDB.LastIndexOf("\\") + 1);

                if (!(bSde))
                {
                    sConnectionToSDEorGDB = sConnectionToSDEorGDB.Substring(0, sConnectionToSDEorGDB.Length - (sConnectionToSDEorGDB.Length - sConnectionToSDEorGDB.LastIndexOf("\\") + 1));
                }
                else
                {
                    sConnectionToSDEorGDB = sConnectionToSDEorGDB.Substring(0, sConnectionToSDEorGDB.Length - (sConnectionToSDEorGDB.Length - sConnectionToSDEorGDB.LastIndexOf("\\")));
                }

                string sMxdOutputDir = MxdOutput;


                pPublishMxd = new MXD.PublishMXD(sMxdTemplate, sArcGisServer, sServiceName, sConnectionToSDEorGDB, sDataSet, sMxdOutputDir, bSde);
                return(pPublishMxd.Publish(agsConnection, sPythonScript));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                pPublishMxd = null;
            }
        }