Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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/se...ver/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){});


    }
share|improve this question
    
I have a feeling the error is related to loading your page from the file system as opposed to serving it from a web server. You should use a local instance of IIS, Apache or some other web server when developing/testing a JS API app. In your case, since you're using an asp.net proxy, you should server your app from IIS. –  Derek Swingley May 25 '12 at 2:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.