Select to view content in your preferred language

Geometry server convex hull issue

371
1
12-12-2023 09:00 PM
EdX1
by
Occasional Contributor

We've been trying to use a geometry server to calculate a convex hull of geometries, however our request gives a 400 error. This is even seen in the example request found at 

https://developers.arcgis.com/rest/services-reference/enterprise/convex-hull.htm

 

For reference this is the URL using the tasks URL:

http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/convexHull?geometries={%2...

 

Does anyone know what is causing the error?

 

 

1 Reply
AnjulPandey
Regular Contributor

Hello,

It is recommended that you create a geometry service object for use within your applications.

var geometryService = new esri.tasks.GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
//calculate the convex hull
         
var points = dojo.map(features,function(feature){
           
return feature.geometry;
         
});
          geometryService
.convexHull(points,function(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){
            console
.log("An error occured during convex hull calculation");
         
});
0 Kudos