ThinkGeo.com    |     Documentation    |     Premium Support

ArcGisRestLayer Error 400 Bad Request

Hello,

I’m having trouble getting a good response using the ArcGisServerRestLayer for the Natural England data sets which are presented by ArcGIS as Feature Services - are these supported?

arcGISServerRestLayer arcGisLayer = new ArcGISServerRestLayer();
arcGisLayer.ServerUri = new Uri("https://services.arcgis.com/JJzESW51TqeY9uat/ArcGIS/rest/services/DalbyFields/FeatureServer/query"); 

arcGisLayer.ImageFormat = ArcGISServerRestLayerImageFormat.Png;
arcGisLayer.Parameters.Add("layerDefs", @"[{'layerId' : 0}]");
arcGisLayer.Parameters.Add("returngeometry ", "true");

LayerOverlay layerOverlay = new LayerOverlay();
            layerOverlay.Layers.Add("ArcGISServerRestLayer", arcGisLayer);
            winformsMap1.Overlays.Add(layerOverlay);

The string built is:
https://services.arcgis.com/JJzESW51TqeY9uat/ArcGIS/rest/services/DalbyFields/FeatureServer/query?LAYERDEFS=%5B%7B%27layerId%27+%3A+0%7D%5D&RETURNGEOMETRY =true&BBOX=-142.735601382775%2C22.4045955348518%2C-55.2643986172248%2C67.5954044651482&SIZE=1653%2C854&format=Png&F=image

The request is fine(manually) if the F=Image is removed so I’m assuming my approach to this is wrong.

I have the current extent set.

Thanks,
Sam

Hi Sam,

Please refer this post: ArcGISRestLayer URI Returning 404 Error

It looks the server you chosen is not an image service, it only support 4 types operation:

https://services.arcgis.com/JJzESW51TqeY9uat/ArcGIS/rest/services/DalbyFields/FeatureServer/0
Supported Operations: Query, Query Top Features, Generate Renderer, Validate SQL

And the valid service for example: http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer
Supported Operations: Export Map

Wish that’s helpful.

Regards,

Ethan