jidanpengshitou

buffer analyst has non effect, here is my code, please help me

Discussion created by jidanpengshitou on Jul 31, 2013
<!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>Simple Map</title>
    <link rel="stylesheet" type="text/css" href="esri/js/dojo/dijit/themes/claro/claro.css"/>
    <link rel="stylesheet" type="text/css" href="esri/js/esri/css/esri.css" />
    <script type="text/javascript" src="esri/init.js"></script>
    <script type="text/javascript">
     //????????????????????????????
  require(["esri/map","dojo/parser","dojo/on","dojo/dom","dojo/_base/Color",
  "dojo/_base/array","esri/geometry/Extent","esri/tasks/GeometryService","esri/dijit/Scalebar",
     "dijit/layout/BorderContainer","dijit/layout/ContentPane","esri/layers/FeatureLayer",
     "esri/symbols/SimpleFillSymbol","esri/symbols/SimpleLineSymbol","esri/graphic",
     "dijit/TitlePane","esri/dijit/BasemapGallery","esri/dijit/OverviewMap",
     "esri/tasks/BufferParameters",
     "dojo/domReady!"], function(Map,parser,on,dom,Color,Array,Extent,GeometryService){
   //????????????????dijit????
   parser.parse();
   //????????????????????????????????
   var initExtent = new esri.geometry.Extent({
    "xmin":73.595722,
    "ymin":18.2407366,
    "xmax":134.7725712,
    "ymax":53.482465,
    "spatialReference":{"wkid":102100}
   });
   //????????????????????????????id="mapDiv"?????????
   var myMap = new esri.Map("mapDiv",{
    basemap : "topo", //??????????url???????esri??????????topo,satellite????????
    extent : initExtent, //???????????
    logo : false, //????????esri???logo
    //nav : true, //????????????????????????????????
    navigationMode : "css-transforms",
    center : [-255.255, 35.022],
    zoom : 5, //????????
    slideStyle : "small"
   });
  
   var featureLayer = new esri.layers.FeatureLayer("http://192.168.1.142/ArcGIS/rest/services/chinaarea/chinaarea/MapServer/0",{
    mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
    outFields: ["*"]
   });
  
   myMap.addLayer(featureLayer);
  
   //??????????????
   var baseMapGallery = new esri.dijit.BasemapGallery({
    showArcGISBasemaps : true, //????ArcGIS????????
    map : myMap //????????map??
   }, "baseMapGallery"); //baseMapGallery?????????????
   //??????????????????????????????????????
   baseMapGallery.startup();
   //????dojo/on???????????????????????????????
   on(baseMapGallery, "onError", function(msg){
    console.log(msg);
   });
  
   //????????????????????????????????????????????????????????????????
   on(myMap, "load", function(){
    //???????????
    var overviewMap = new esri.dijit.OverviewMap({
     attachTo : "bottom-right",
     map : myMap,
     color : "#FF0000",
     width : 200,
     height : 200,
     visible : true
    });
    //???????????
    overviewMap.startup();
    on(overviewMap, "onError", function(msg){
     console.log(msg);
    });
   });
  
   //?????????
   var scaleBar = new esri.dijit.Scalebar({
    map : myMap,
    attachTo : "bottom-left",
    scalebarUnit : "metric"
   });
   //scaleBar????startup()?????????????show()????????????????????
   scaleBar.show();
  
   //Define the geometry service that will be used to perform the buffer.
         var geometryService = new esri.tasks.GeometryService("http://192.168.1.142/ArcGIS/rest/services/Geometry/GeometryServer");

   //on(featureLayer, "mouse-over", function(evt) {
   on(featureLayer, "click", function(evt) {
    var result = dom.byId("result");
    var text = "<b>??????${name} ????ID??${osm_id}</b>";
    var content = esri.substitute(evt.graphic.attributes, text);
    result.innerHTML = content;
    myMap.graphics.clear();
    var params = new esri.tasks.BufferParameters();
    params.distances = [20, 30];
    params.unit = esri.tasks.GeometryService.UNIT_KILOMETER;
    params.outSpatialReference = myMap.spatialReference;
    params.geometries = [evt.mapPoint];
    //params.geometries = [evt.graphic.geometry];
    //??????????????
    geometryService.buffer(params,showBuffer);
    //???????????????????????????
    function showBuffer(geometries) {
     var sym = new esri.symbols.SimpleFillSymbol(esri.symbols.SimpleFillSymbol.STYLE_SOLID,
      new esri.symbols.SimpleLineSymbol(esri.symbols.SimpleLineSymbol.STYLE_SOLID,
       new dojo._base.Color([0, 255, 255, 0.65]), 2), new dojo._base.Color([0, 50, 255, 0.35]));
     //Array??"dojo/_base/array"
     Array.forEach(geometries, function(geo) {
      var gra = new esri.graphic(geo, sym, null, null);
      myMap.graphics.add(gra);
     });
    }
   });
  });
    </script>
  </head>

  <body class="claro" style="height:100%;width:100%;margin:0;padding:0">
   <div data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline', gutters:false" style="width:100%;height:100%;margin:0;position:absolute">
    <div id="topNav" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'" style="height:30px;background-color:#777;">
     <p id="result"></p>
    </div>
    <div id="mapDiv" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" style="padding:0">
     <div style="position:absolute;right:40px;top:30px;z-index:999">
      <div data-dojo-type="dijit/TitlePane" data-dojo-props="title:'?????????', closable:false, open:false">
       <div data-dojo-type="dijit/layout/ContentPane" style="width:380px;height:280px;overflow:auto;">
        <div id="baseMapGallery"></div>
       </div>
      </div>
     </div>
    </div>
   </div>
  </body>
</html>

Outcomes