Geoprocessing service point  buffer

1226
1
03-12-2014 02:25 AM
fatizanady
New Contributor
hello everyone,

I publish a geoprocessing service in arcgis server 10.1 that allows for buffer around points.My question is how can I consomer this      service in my application flex viewer.that I want is to choose a vector layer "point" of my layers and then specify the distance and     display buffers result.

From my research I found:

To add a geoprocessing functionality offered by a task to your Web application, use the following four steps:
- Initialization of the geoprocessing task.
- Settings for the task.
- Execution of the task.
- Display of results.

I tried to start this is what I did this time and I got block:

<?xml version="1.0" encoding="utf-8"?>
<!--
///////////////////////////////////////////////////////////////////////////
// Copyright (c) 2010-2011 Esri. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
///////////////////////////////////////////////////////////////////////////
-->
<viewer:BaseWidget xmlns:fx="http://ns.adobe.com/mxml/2009"
       xmlns:s="library://ns.adobe.com/flex/spark"
       xmlns:mx="library://ns.adobe.com/flex/mx"
       xmlns:esri="http://www.esri.com/2008/ags"
       xmlns:viewer="com.esri.viewer.*"
       xmlns:components="com.esri.viewer.components.*"
      
                   >
    <fx:Script>
        <![CDATA[
   import com.esri.ags.FeatureSet;
   import mx.managers.CursorManager;
   import com.esri.ags.Graphic;
   import com.esri.ags.events.GeoprocessorEvent;
   import mx.controls.Alert;
   import mx.rpc.events.FaultEvent;
   import com.esri.ags.tasks.supportClasses.ExecuteResult;
   import com.esri.ags.tasks.supportClasses.ParameterValue;
   import com.esri.ags.layers.GraphicsLayer;
   import com.esri.ags.geometry.Extent;
   import com.esri.ags.geometry.Geometry;
   import com.esri.ags.geometry.Polygon;
   
   private var graphicsLayer:GraphicsLayer;
   
   // initialisation de la tache 
   
   private function BufferPoint():void
   {
    var requestObject:Object = createRequestObject();
    gp.execute(requestObject);
    CursorManager.setBusyCursor();
    
   }
   
    // paramettes de la tache et execution
   
   private function createRequestObject():Object
   {
    var GPBufferptgraphic:Graphic = new Graphic();  // Graphic=>create a vector shape
    var GPBufferptFeatures:FeatureSet = new FeatureSet([GPBufferptgraphic]);
    var dist:Number = 1000;
    
    var requestObject:Object = {
     "GPBuffer_DBO_points": GPBufferptFeatures,
     "Distance_ ": dist
    };
    
    
    
    return requestObject;
   }
   
   
   
   
   
 
  
   
   
   private function gp_faultHandler(event:FaultEvent):void
   {
    CursorManager.removeBusyCursor();
    showErrorMessage(event.fault.faultString);
   }
   
   private function showErrorMessage(content:String):void
   {
    Alert.show(content, "Geoprocessing Task Error");
    
   }
   

   
   
        ]]>
    </fx:Script>
 <fx:Declarations>
  
  <esri:Geoprocessor id="gp"
         fault="gp_faultHandler(event)"
         outSpatialReference="{map.spatialReference}"
         url="http://localhost:6080/arcgis/rest/services/Geotraitement/BufferPoint/GPServer/BufferPoint"
         useAMF="false"/>
 
 </fx:Declarations> 
    <viewer:WidgetTemplate id="test"
                           width="300" height="300">
  <s:ComboBox id="feature" x="64" y="78" width="173"/>
  <s:TextInput id="Distance" x="28" y="145" width="116"/>
  <s:ComboBox id="unit" x="167" y="145" width="112"/>
  <s:Button x="121" y="211" label="Executer"/>
  <s:Label x="10" y="22" width="281" height="33" text="Choisir une couche vecteur et appliquer un buffer"/>

    </viewer:WidgetTemplate>
</viewer:BaseWidget>



I find a lot of exemple in this contexte, they draw the points which makes the buffer.but me i want to select the layer "point"from my map service and then apply buffer.I'm new to Flex so I'm sure that there are multiple errors but would like to know if I'm going about this the right way? Thanks for any help that could be offered!

[ATTACH=CONFIG]32143[/ATTACH]
Tags (2)
0 Kudos
1 Reply
fatizanady
New Contributor
Anyone can help me?????
0 Kudos