ConvexHull on Query Results

559
0
05-20-2012 01:58 AM
karthik_BharadwajT
New Contributor
I am trying to achieve a convex hull over a feature Set returned by a query. But have been facing the error below which i am not able to figure out

In order to debug to see how the convex hull works i had mocked up features and ran the convex hull for the created poly line features as seen in the below code. This works fine, But the above approach of plotting a convexhull for the feature set fails with the below error.

Error:

1) OPTIONS file:///C:/wip/maps/code/test/proxy.ashx?http://karthikpc:8399/arcgis/rest/services/Geometry/GeometryServer/convexHull Resource failed to load
2) Another is a type error
TypeError
arguments: Array[2]
get message: function () { [native code] }
get stack: function () { [native code] }
set message: function () { [native code] }
set stack: function () { [native code] }
type: "non_object_property_load"
__proto__: Error

Have given my function below.
function bounding_polygon(featureSet){
        var geometries = [];
  
        var geometries_1 = [];
        var geoms=[];
 var symbol =  new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0,0.85]), 2);
 
      //getting geometry from feature set
       var geoms = dojo.map(featureSet.features, function(graphic) {
        return graphic.geometry;
        });
        map.graphics.clear(); 
         //function that fails
          gsvc.convexHull(geoms,function store_value(result){ 
  var symbol;
  switch(result.type){
              case "point":
                symbol = new esri.symbol.SimpleMarkerSymbol();
                break;
              case "polyline":
                symbol = new esri.symbol.SimpleLineSymbol();
                break;
              case "polygon":
                symbol = new esri.symbol.SimpleFillSymbol();
                break;
            }
   map.graphics.add(new esri.Graphic(result,symbol));
  },function error_log(error){});

 //trying to run the same for manually created geometries
       var new_polyline= new esri.geometry.Polyline(map.spatialReference);
 var other_polyline= new esri.geometry.Polyline(map.spatialReference);
 new_polyline.addPath([[103.76794615402221, 1.4416487206261546], [103.76790721700029, 1.4427548269642734], [103.76789991705209, 1.4429139656905441]]);
 other_polyline.addPath([[103.77897404312868, 1.3687951231704805], [103.7789286010334, 1.36900185852713], [103.7788202535522, 1.3694226417416273]]);
 geometries_1[0]=new_polyline;
 geometries_1[1]=other_polyline;
  
 gsvc.convexHull(geometries_1,function store_value(result){ 
 var symbol;
     switch(result.type){
              case "point":
                symbol = new esri.symbol.SimpleMarkerSymbol();
                break;
              case "polyline":
                symbol = new esri.symbol.SimpleLineSymbol();
                break;
              case "polygon":
                symbol = new esri.symbol.SimpleFillSymbol();
                break;
            }
   map.graphics.add(new esri.Graphic(result,symbol));
  
  },function error_log(error){});
  
   
  } 


Let me know if i would need to clarify more on this.
0 Kudos
0 Replies