Select to view content in your preferred language

GeometryServer/buffer request error 400 extendedCode -2147024809

675
1
Jump to solution
06-19-2023 05:56 AM
JamesCrandall
MVP Frequent Contributor

Having some difficulty with a post request to our ArcGIS Server buffer utility endpoint and coming up with this response when executing in python requests, but running the same exact input parameters on the Utilities/Geometry/GeometryServer/buffer REST page it works. Error message:

 

{'error': {'code': 400, 'extendedCode': -2147024809, 'message': 'Invalid or missing input parameters.', 'details': []}}

 

 Python script / code:

#create 250ft buffer for ROW canal selections
geomInput = {"geometryType": "esriGeometryPolygon", "geometries": [{"rings": ringFeat['rings']}]}
print (geomInput)

queryURL_buff = 'https://somedomain.com/servername/rest/services/Utilities/Geometry/GeometryServer/buffer'
paramsBuff = {'f': 'json',
			  'geometries': geomInput,
			  'inSR': 2881,
			  'outSR': 2881,
			  'bufferSR': 2881,
			  'distances': 250,
			  'unit': 9003,
			  'unionResults': 'true',
			  'geodesic': 'false',
			  'token': tok
			  }

reqBuff = requests.post(queryURL_buff, data = paramsBuff, verify=False)
responseBuff = json.loads(reqBuff.content)

 

Here's the input Geometries parameter "geomInput", that comes from an initial request to a service layer on published on the same ArcGIS Server site, SR 2881:

{'geometryType': 'esriGeometryPolygon', 'geometries': [{'rings': [[[495575.2709925808, 885508.40553274], [495550.90457149595, 882849.2146569043], [494801.263026163, 882859.831105493], [494741.2670831606, 882860.6811694056], [494559.8045195788, 882863.2520304099], [494349.84627807885, 882866.2267619893], [494140.0382987447, 882869.1978846565], [493930.3799254112, 882872.1686792374], [493720.87575124577, 882875.1355368197], [493511.52183924615, 882878.1017382368], [493302.3175332472, 882881.0643307418], [493082.0259790793, 882884.1853874922], [492918.59684399515, 882886.4980469048], [492922.98856749386, 883580.9809099063], [492889.98830541223, 883581.418573074], [492893.9925624952, 884214.7765583247], [492860.99295657873, 884215.2056913227], [492810.41759841144, 884215.8598894924], [492562.22616566345, 884219.0767465755], [492395.6389004141, 884221.2348787412], [492229.02637274563, 884223.3933389932], [491895.8219866641, 884227.7141964883], [491562.6179286614, 884232.0347259045], [491229.4181357473, 884236.3516464084], [491022.93068782985, 884239.0265098214], [490563.0139567442, 884244.9890963212], [490228.3850328289, 884249.3266860768], [489896.68097182736, 884253.6265462413], [489730.08091132715, 884255.7850064933], [489563.4769138284, 884257.9474037364], [489568.5769692473, 884889.7184499055], [489574.1684934944, 885582.6845836565], [492902.3800129108, 885541.4887999073], [495575.2709925808, 885508.40553274]]]}]}

 

JamesCrandall_0-1687179379832.png

 

0 Kudos
1 Solution

Accepted Solutions
JamesCrandall
MVP Frequent Contributor

Ok looks like the geometries input parameter is not expecting loaded json objects.  The solution is to pass in the json.dumps() of the geometries:

 

paramsBuff = {'f': 'json',
	      'geometries': json.dumps(geomInput),
	      'inSR': 2881,
	      'outSR': 2881,
	      'bufferSR': 2881,
	      'distances': 250,
	      'unit': 9003,
	      'unionResults': 'true',
	      'geodesic': 'false',
	      'token': tok
	     }

View solution in original post

0 Kudos
1 Reply
JamesCrandall
MVP Frequent Contributor

Ok looks like the geometries input parameter is not expecting loaded json objects.  The solution is to pass in the json.dumps() of the geometries:

 

paramsBuff = {'f': 'json',
	      'geometries': json.dumps(geomInput),
	      'inSR': 2881,
	      'outSR': 2881,
	      'bufferSR': 2881,
	      'distances': 250,
	      'unit': 9003,
	      'unionResults': 'true',
	      'geodesic': 'false',
	      'token': tok
	     }
0 Kudos