100.3 WebTiledLayer can't load map

2674
3
Jump to solution
08-30-2018 04:42 AM
chenyangyang
New Contributor

I can't load the China tianditu using the Android Runtime SDK 100.3 version of WebTileLayer. The 100.1 version can be loaded and displayed correctly. Has the new version been modified?

Service address: http://{subDomain}.tianditu.com/DataServer?T=vec_w&x={col}&y={row}&l={level}

0 Kudos
1 Solution

Accepted Solutions
ShellyGill1
Esri Contributor

Hi there - I have tested out this service, and there does seem to be some problem - I can use other tiled services with WebTiledLayer in 100.3 OK, but am not seeing this specific service display at 100.2 or 100.3 (works with same code in 100.1). I will report this to the team, and post back here with any information we find out. Thanks for reporting this issue, and apologies it took a while to reply.

**Update** chen yangyang‌ - We've looked into this issue and have found what we believe is the cause. Info I got from the developers is that at 100.2, we added a default referer value to the header of each HTTP/S request made by the ArcGIS Runtime SDK for Android (to address other issues and functionality).  The referer value at 100.0 was empty, but the refer value at 100.2 will be, for example 

ArcGISRuntime-Android/100.2 (<android platform and device details here>)

It appears that this referer value is not being accepted by the tianditu server - possibly it rejects referer strings that do not contain a valid URL, but I don't really know much about what would or would not be accepted. Perhaps the service documentation includes information about which referer values will be accepted and which will not? As a workaround, you can change the default request header for your specific layer here that is working with this server, e.g. 

RequestConfiguration requestConfiguration = new RequestConfiguration();
requestConfiguration.getHeaders().put("referer", "<Your own referer value here - for example your companies URL>");
yourTiandituWebTiledLayer.setRequestConfiguration(requestConfigurationWithYourReferer);

For example, we found that a value of "referer", "http://www.arcgis.com" for the  RequestConfiguration.getHeaders().put call worked OK, but you may want to experiment and use something appropriate for your specific case.

It's also possible to change the default request header for all of the calls from the Runtime app by using the RequestConfiguration.setGlobalRequestConfiguration instead, but that would affect all the calls made by the runtime, so may not be as appropriate for you. 

Incidentally, have you ever used the Esri app (for example Collector, Explorer) with this server? I think this may be an issue there, and will pass this on to the apps teams.

Regards,

Shelly

View solution in original post

3 Replies
ShellyGill1
Esri Contributor

Hi there - I have tested out this service, and there does seem to be some problem - I can use other tiled services with WebTiledLayer in 100.3 OK, but am not seeing this specific service display at 100.2 or 100.3 (works with same code in 100.1). I will report this to the team, and post back here with any information we find out. Thanks for reporting this issue, and apologies it took a while to reply.

**Update** chen yangyang‌ - We've looked into this issue and have found what we believe is the cause. Info I got from the developers is that at 100.2, we added a default referer value to the header of each HTTP/S request made by the ArcGIS Runtime SDK for Android (to address other issues and functionality).  The referer value at 100.0 was empty, but the refer value at 100.2 will be, for example 

ArcGISRuntime-Android/100.2 (<android platform and device details here>)

It appears that this referer value is not being accepted by the tianditu server - possibly it rejects referer strings that do not contain a valid URL, but I don't really know much about what would or would not be accepted. Perhaps the service documentation includes information about which referer values will be accepted and which will not? As a workaround, you can change the default request header for your specific layer here that is working with this server, e.g. 

RequestConfiguration requestConfiguration = new RequestConfiguration();
requestConfiguration.getHeaders().put("referer", "<Your own referer value here - for example your companies URL>");
yourTiandituWebTiledLayer.setRequestConfiguration(requestConfigurationWithYourReferer);

For example, we found that a value of "referer", "http://www.arcgis.com" for the  RequestConfiguration.getHeaders().put call worked OK, but you may want to experiment and use something appropriate for your specific case.

It's also possible to change the default request header for all of the calls from the Runtime app by using the RequestConfiguration.setGlobalRequestConfiguration instead, but that would affect all the calls made by the runtime, so may not be as appropriate for you. 

Incidentally, have you ever used the Esri app (for example Collector, Explorer) with this server? I think this may be an issue there, and will pass this on to the apps teams.

Regards,

Shelly

chenyangyang
New Contributor

Thank you very much, this service is a national public service platform, I don't know if it uses esri app.

0 Kudos
willwang
New Contributor

ArcGIS Android SDK I use; Use webfiledlayer to load TIF graphics on the network. The requested resource needs to transmit other parameters such as token; Now how do I view the HTTP request sending and reply logs? For example, error code 401 or 200, I need to get more log information. The ArcGIS IOS SDK can print logs, but how does the ArcGIS Android SDK print logs? Now, the TIF cannot be loaded successfully and there is no prompt. Where can I track problems? Please help me.

0 Kudos