I am trying to put together a very basic sandbox app to load data from a public ArcGIS Server MapService using the Javascript 3.5 API.
However I keep getting the a 400 return status with the error "Output format not supported"
The code is as follows:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Simple Image Service</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.25/esri/css/esri.css" />
<style>
html, body, #map { height: 100%; width: 100%; margin: 0; padding: 0; }
</style>
<script src="https://js.arcgis.com/3.25/"></script>
<script>
var map;
require([
"esri/map", "esri/layers/ArcGISImageServiceLayer",
"esri/layers/ImageServiceParameters", "dojo/parser", "dojo/domReady!"
], function(
Map, ArcGISImageServiceLayer,
ImageServiceParameters, parser
) {
parser.parse();
map = new Map("map", {
basemap: "topo",
center: [-79.40, 43.64],
zoom: 12
});
var params = new ImageServiceParameters();
params.noData = 0;
var imageServiceLayer = new ArcGISImageServiceLayer("https://clientsServer/arcgis/rest/services/TEST/MyMapService/MapServer", {
imageServiceParameters: params,
opacity: 0.75
});
map.addLayer(imageServiceLayer);
});
</script>
</head>
<body>
<div id="map"> </div>
</body>
</html>
Here is a screen shot of the Network tab in the dev tools enter image description here
I tried using the following but they also didn't display (I'm not sure what they mean, just found then in another post)
- https://clientsServer/arcgis/rest/services/TEST/MyMapService/MapServer/export https://clientsServer/arcgis/rest/services/TEST/MyMapService/MapServer/tile
Most simple sandbox app ever, and already scratching my head.... :o(
Any help greatefully recieved
1 Answer 1
The problem is that you are trying to create an ArcGISImageServiceLayer layer based on a map service REST end point AND feeding ImageServiceParameters
. The server then expects that this would be a map service with the imagery support, however, most likely yours is not one.
Most likely, you would need to use the ArcGISDynamicMapServiceLayer
instead.
-
Hi Alex, Yup you were right. Changed code to as follows: urlUtils.addProxyRule({ urlPrefix: "gis.subsea7.com/arcgis/rest/services", proxyUrl: "localhost/ESRI-Proxy/proxy.ashx" }); ArcGISDynamicMapServiceLayer("clientsServer/arcgis/rest/services/TEST/MyMapService/MapServer", { "opacity" : 0.5, "imageParameters" : imageParameters }); Used the ESRI proxy at : github.com/Esri/resource-proxy/tree/master/DotNet so clients server is not setup for CORS. Many thanks for the help!KieronFlynn– KieronFlynn2018年09月17日 14:05:56 +00:00Commented Sep 17, 2018 at 14:05
-
No worries, glad it worked out well. I can recommend keeping the REST API help page handy as you will likely spend some time there developers.arcgis.com/rest/services-reference/map-service.htm. Also, since you are exploring the ArcGIS Server REST API, I also suggest installing Postman and poking around submitting some requests and seeing what you can get back, super helpful app.Alex Tereshenkov– Alex Tereshenkov2018年09月17日 14:21:44 +00:00Commented Sep 17, 2018 at 14:21
Explore related questions
See similar questions with these tags.