Is it possible to have a ArcGISServerRestLayer work with projections? Not sure what I’m doing wrong. I am using the .Parameters["outSR'] and setting to whatever my map’s external projection is in (for example, 3395). When I add the layer to the map, nothing shows. If my map is in wgs84 (4326), it does show.
ArcGISServerRestLayer with projections
Hi Dan,
Can you do the following and get the request URI:
public ArcGisServerRestAsyncLayer(Uri serverUri, IWebProxy webProxy): base(serverUri, webProxy)
{
this.SendingHttpRequest += (sender, args) =>
System.Diagnostics.Debug.WriteLine(args.HttpRequestMessage.RequestUri.AbsoluteUri.ToString());
}
and try the request URI in a browser see if it returns a correct result.
And if it does, can you also make sure the map’s Unit is set to Feet (EPSG:3359’s unit is Feet according to https://epsg.io/3359), and the mapView’s CurrentExtent is correct.
If there’s still no clue, please send me a code snippet about how the layer is initialized.
Thanks,
Ben
Sorry about that, the srid is 3395, not 3359. Updated my post. But yes, the map units are in meters. I’ll check the request URI
Here’s the full message request uri:
https://sampleserver6.arcgisonline.com/arcgis/rest/services/911CallsHotspot/MapServer/Export?LAYERS=show%3A1&TRANSPARENT=true&OUTSR=3395&BBOX=-10036825.9878382%2C36143.7442066222%2C-36143.7442066222%2C10036825.9878382&SIZE=512%2C512&F=image
trying it in the browser just shows an empty box (it does the same with any projection).
This is using 13.1.2 thinkgeo.core. and i’m just using the constructor that takes a uri: 
Hi Dan,
Your request returns an empty image because it exceeds the data bounding box defined on your server.
You can get the full extent here: https://sampleserver6.arcgisonline.com/arcgis/rest/services/911CallsHotspot/MapServer
This is a valid request for example:
https://sampleserver6.arcgisonline.com/arcgis/rest/services/911CallsHotspot/MapServer/export?bbox=7588427.77,649862.72,7627018.74,683245.92&bboxSR=102726&size=512,512&format=png&f=image
so the image will only show up correctly when within the extent the server supported.
Thanks,
Ben
ok so the outSR parameter can stay then? and it’s just the extent? I see the request in thinkgeo changes based on my projection. I’m not setting the bbox extent manually. It looks like thinkgeo is?
You can set the Unit/CurrentExtent in a MapView, but not a projection, so what do you mean by “I see the request in thinkgeo changes based on my projection.”? After switching a projection, you need to set a proper CurrentExtent to MapView to match the new projection.
hooking into the “sendinghttprequest” and looking at the request. I see it being sent off whenever the map refreshes (panning, zooming, changing the projection), and the bbox parts of the request are changing automatically. When I change all my layers to a certain projection, I’m just setting the map’s unit to match the projection unit. I’m not doing anything to set the bbox parts of the request.
I’m just trying to figure out how to properly get this layer showing up on my map, and being handled correctly when I change projections. For other layers it’s just simply updating the projection converter on those layers.
Hi Dan,
Are you sure the server supports SRID 3395? I only see it supports 102726 from the server specification page: https://sampleserver6.arcgisonline.com/arcgis/rest/services/911CallsHotspot/MapServer, (that’s why my demo page above uses 102726)
Also want to make sure are you expecting the server to return the image in 3395, or you are looking for 4326 images from the server and want to do the projection on the client side?
Thanks,
Ben
Ah I see what you mean. Yeah 4326 (or any projection) is fine, as long as I can project it to what my other layers are in. I thought the param on the request had to include the projection srid I wanted it in. Didn’t realize there was a bboxSR and outSR also. I’ll have to check what the differences are.
I see. Just let us know when you see any more issues.
