Select to view content in your preferred language

FeatureLayer::query() - Force HTTP POST instead of GET?

348
2
Jump to solution
3 weeks ago
MobiusSnake
MVP Regular Contributor

Hi, I ran into an issue earlier where the query() call would result in what looked like a JSON decoding error.  This is code that I'd run many, many times before, so I dug into it and the cause was an unusually complex polygon being passed in as a filter.  I copied the filter's geometry into the REST API web interface and GET failed, while POST behaved as expected, seemingly due to the data limit with HTTP GET.

I built in a workaround for this specific script, but is there a way to force query() to use POST rather than GET in the future?  If not, is there an existing idea for this?  (I looked but couldn't find one.)

0 Kudos
1 Solution

Accepted Solutions
Clubdebambos
MVP Regular Contributor

I had a similar error using complex polygons and union() and I vaguely recall that this was due to be fixed in 2.4.2. I can't remember where I read that, but more than likely on the Esri GitHub.

EDIT: found links

https://github.com/Esri/arcgis-python-api/issues/2345

https://github.com/Esri/arcgis-python-api/issues/2334

 

Further Edit:

My workaround, although I wasn't performing a similar workflow to yours, was to convert all geometry to Shapely geoms, use the Shapely functions for union/dissolve and convert back to ArcGIS API for Python type features.

~ learn.finaldraftmapping.com

View solution in original post

2 Replies
Clubdebambos
MVP Regular Contributor

I had a similar error using complex polygons and union() and I vaguely recall that this was due to be fixed in 2.4.2. I can't remember where I read that, but more than likely on the Esri GitHub.

EDIT: found links

https://github.com/Esri/arcgis-python-api/issues/2345

https://github.com/Esri/arcgis-python-api/issues/2334

 

Further Edit:

My workaround, although I wasn't performing a similar workflow to yours, was to convert all geometry to Shapely geoms, use the Shapely functions for union/dissolve and convert back to ArcGIS API for Python type features.

~ learn.finaldraftmapping.com
KenGalliher1
Esri Contributor

Adding to the response from @Clubdebambos : This was fixed to allow for long url strings to be properly decoded in a GET request. The fix can be found in the 2.4.1.3 patch and the latest 2.4.2 release.