⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 demo7_geoprocessing.html

📁 采用java实现的arcgis server程序
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>JavaScript Seminar</title>
    <script type="text/javascript">djConfig = { parseOnLoad:true }</script>
    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.1"></script>
    <style type="text/css">
      @import "http://serverapi.arcgisonline.com/jsapi/arcgis/1.1/js/dojo/dijit/themes/tundra/tundra.css";
    </style>
    <script type="text/javascript">

        //This demo application is intended for education purposes only and associated with the
        //ESRI JavaScript API 1/2 day seminars presented in the fall of 2008.

        //Register for seminars at:
        // http://www.esri.com/events/seminars/arcgis93_server/index.html


        //All the services used in the following demonstrations rely on ESRI sample servers. 
        //The services running on the sample servers may change in the future; 
        //thus, you should not rely on the services in your own applications. 
        //The sample server services are being utilized in this seminar for demonstration purposes only.  
        //As the demonstrations rely on the sample servers, the content of these demos will only be valid as long as the services on the sample servers continue to run.
    
    
      dojo.require("esri.map");
      
     dojo.require("dijit.TitlePane"); //For floating panel
     dojo.require("dijit.form.TextBox");
      
      var map; //represents esri.map
      var imagery; //arcgisonline imagery
      var streetMap; //arcgisonline streetmap data
      var portlandService; //Portland Data from sample server

      function init() {
         var startExtent = new esri.geometry.Extent({ xmin: -123.6, ymin: 44.873, xmax: -121.645, ymax: 45.793, spatialReference: new esri.SpatialReference({wkid: 4326})});
         map = new esri.Map("map", { extent:startExtent } );
         
        imagery = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_Imagery_World_2D/MapServer");
        map.addLayer(imagery);
        
        streetMap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer", {id:"streetMap"});
        map.addLayer(streetMap);
        streetMap.hide();
        
         portlandService = new esri.layers.ArcGISTiledMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Portland/Portland_ESRI_LandBase_AGO/MapServer", {id:"portlandService"});
         portlandService.setOpacity(0.75);
         map.addLayer(portlandService);
         
        //Geoprocessor for clip and ship
        gp = new esri.tasks.Geoprocessor("http://sampleserver2.arcgisonline.com/ArcGIS/rest/services/Portland/ESRI_CadastralData_Portland/GPServer/ClipAndShip");
        gp.setOutputSpatialReference({wkid:4326});
      }

      function TurnOffStreetMap() {
          streetMap.hide();
          imagery.show();
      }

      function TurnOffImagery() {
          imagery.hide();
          streetMap.show();
      }
      
            function initToolbar() {
        map.graphics.clear();
        var tb = new esri.toolbars.Draw(map);

        //find points in Extent when user completes drawing extent
        dojo.connect(tb, "onDrawEnd", addClipGraphic);

        //set drawing mode to extent
        tb.activate(esri.toolbars.Draw.POLYGON);
      }
      
      function addClipGraphic(geometry) {
          var symbol = new esri.symbol.SimpleLineSymbol();

          map.graphics.add(new esri.Graphic(geometry, symbol));

      }

      function clipship() {
        //Need to pass in a polygon since that is what the GP service wants.  Extent will not work
        var features= [];
	       features.push(map.graphics.graphics[0]);
      	var featureSet = new esri.tasks.FeatureSet();
	     featureSet.features =  features;
        var params = { "Area_to_Zip":featureSet, "Email_Zip_To":dojo.byId("emailAddress").value };
        gp.submitJob(params, clipshipcomplete, statusCallback);
      }

      function clipshipcomplete(jobInfo) {
	      alert("Clip and Ship has completed.  You should receive an email any minute now....");
	      map.graphics.clear();
      }

      function statusCallback(jobInfo) {
        dojo.byId("lblGPStatus").innerHTML = "Job Status: " + jobInfo.jobStatus;
      }



      dojo.addOnLoad(init);
    </script>
  </head>
   <body class="tundra">
    <table>
      <tbody>
        <tr>
          <td>
            <div style="position:relative;">
              <div id="map" style="width:1100px; height:600px; border:1px solid #000;">
              </div>
              <div style="position:absolute; right:25px; top:10px; z-Index:999;">
                        <button dojoType="dijit.form.Button" onClick="TurnOffStreetMap();">Imagery</button>
                        <button dojoType="dijit.form.Button" onClick="TurnOffImagery();">Street Map</button>
                   <div dojoType="dijit.TitlePane" title="Clip and Ship" open="false" style="width:350px">
                           <table>
                                  Click the button below, then draw a polygon of the area you would like data to be extracted
                                  <br />
                                  <button onclick = "initToolbar()"; style="display: block;float: right; margin: 6px 0 20px 0; clear: both; border: 1px solid #999; background: #EEEEEE">Draw Polygon to Clip to</button> 
                                  <br />
                                  Email address to send .zip file
                                  <br />
                                   <input id="emailAddress" type="decimal" name="parcelID" value="" dojoType="dijit.form.TextBox"  /> <br/>
                                   <button onclick = "clipship()"; style="display: block;float: right; margin: 6px 0 20px 0; clear: both; border: 1px solid #999; background: #EEEEEE">Execute Clip and Zip</button> 
	                                 <br />
                                   <label id="lblGPStatus">Job Status: Not started</label><br>
                           </table>
                   </div>

              </div>
            </div>
          </td>
          <td valign="top">

          </td>
        </tr>
      </tbody>
    </table>
  </body>

</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -