drawing FeatureLayer error:400

937
6
04-26-2013 10:03 AM
RyanClancy
Occasional Contributor
When I add a map service to my map as an ArcGISDynamicMapServiceLayer it works as I expect. When I add the same map service as a FeatureLayer it works at larger scales but at smaller scales some of the features render but then one of the GET requests is met with this:

{"error":{"code":400,"message":"Unable to complete operation.","details":[]}}

How do I troubleshoot this? It's not like I'm overwhelming the server with GET requests at the full extent (only 32 features in total) so why does this work at large scales but not small scales?

The only change in my code between dynamic layer and feature layer are the addition of "/0" to the service url in the layer constructor, and the addition of "mode: esri.layers.FeatureLayer.MODE_ONDEMAND" to the parameter list.

Details:
JSAPI 3.4
Firefox 11.0 (Old, I know. It's out of my control!)
ArcGIS Server 10.1

The map service contains 32 point features in web merc. aux. sphere (same projection as map to which it is added).

Thanks,
Ryan
0 Kudos
6 Replies
JohnGravois
Frequent Contributor
kind of strange...

i would suggest copy/pasting the query requests spawned from the application and testing them directly in the browser to try and determine whether ArcGIS Server is returning errors intermittently or whether it has a problem with some specific requests.
0 Kudos
RyanClancy
Occasional Contributor
kind of strange...

i would suggest copy/pasting the query requests spawned from the application and testing them directly in the browser to try and determine whether ArcGIS Server is returning errors intermittently or whether it has a problem with some specific requests.


Good idea; this led me to discover that only GET requests where the esriGeometryEnvelope used to request features encompasses the FeatureLayer and the edge of the map cause errors.

1 - If I zoom to the edge of the map in an area where my points would not be visible and add the FeatureLayer it works; as I pan around and my area of interest becomes visible while the edge of the map is still visible I get an error 400. 

2 - If I zoom to the edge of the map in an area where my points would be visible and add the FeatureLayer I get an error 400.

3 - If I zoom to an extent where my points would be visible but the GET esriGeometryEnvelope does not touch the edge of the map all features are loaded without error. As I pan around, I get an error 400 when the GET request esriGeometryEnvelope touches the edge of the map.

I tried this with the map's wraparound180 parameter set to true and then false. Results are the same. When I refer to the edge of the map I mean longitude values of -180° or 180° (or since I'm in mercator,  -20037508 meters and 20037508 meters).
0 Kudos
JohnGravois
Frequent Contributor
is your service public?  if not, can you repro with a public service?  i have a hunch theres something wrong with the extents set for the layer but its hard to say...
0 Kudos
RyanClancy
Occasional Contributor
Two more items of relevance:

1 - The map service containing the point features is derived from a GP service. I turned on the "View results with a map service" option on the GP service so that I could do stuff like this. Does this derived map service have some kind of dummy .mxd on the server in which the origin/coordinate system/extent/etc could be causing the problem?

2 - I changed the FeatureLayer mode to SNAPSHOT and this solves the problem for now because the api requests all features in this mode and doesn't use an esriGeometryEnvelope to get features. This is only a temporary solution for me because when we release this app to actual users they'll be doing this with many more features than I tested and we'll want to use ONDEMAND mode.
0 Kudos
RyanClancy
Occasional Contributor
is your service public?  if not, can you repro with a public service?  i have a hunch theres something wrong with the extents set for the layer but its hard to say...


Unfortunately I'm working on a locked down intranet and can't make anything public. Pretty inconvenient, I know. 😞

I'll try to check the layer extents and see what I find.
0 Kudos
RyanClancy
Occasional Contributor
is your service public?  if not, can you repro with a public service?  i have a hunch theres something wrong with the extents set for the layer but its hard to say...


The service in question is created by ArcGIS Server as the result of a gp service (I checked off the "View result as map service" box). Is there a way to control the extents of automatically generated map services?

Thanks
Ryan
0 Kudos