Starting at ArcGIS Server 10.8, for map services using the ArcGIS Pro runtime, the export request now supports the clipping parameter to clip the image produced, according to the geometry included in the clipping parameter.
This works fine when I test it manually (e.g. Either through the ArcGIS REST Services Directory for the export request, or by using Postman). The image is clipped. However I need to do this clipping within a web application using the ArcGIS API for Javascript 3.
For instance for the ArcGISDynamicMapServiceLayer I see no obvious way to input this clipping parameter. Neither directly or through some other configuration. Is this possible?
If this is not currently supported in the ArcGIS API for Javascript 3, is there a way to hack in some extra parameters when the API makes export requests? So that I could manually set this clipping myself?
Solved! Go to Solution.
In terms of hacks, I think esriRequest.setRequestPreCallback may be your best bet. It allows you to intercept and modify requests before they're sent. I think it's there that you could add the clipping parameter and value.
In terms of hacks, I think esriRequest.setRequestPreCallback may be your best bet. It allows you to intercept and modify requests before they're sent. I think it's there that you could add the clipping parameter and value.
I guess that could work if I did the request manually myself whenever the map was panned or zoomed, but I'd prefer letting the API do the export request itself.
I did some experimenting and found that I could hack in some extra parameters by adding them to the private _params property of the layer.
Actually Joel, you were right. It does appear that esriRequest.setRequestPreCallback is called for each and every export request automatically. That's very nice, and will simplify a lot of things for me.
Thanks!