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={%22geometryType%22:%22esriGeometryPoint%22,%22geometries%22:[{%22x%22:-117,%22y%22:34},{%22x%22:-116.5,%22y%22:34.5},{%22x%22:-116,%22y%22:33}]}&sr=4326&f=pjson
Does anyone know what is causing the error?
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"); });
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.