Select to view content in your preferred language

Bug: 4.16+ Webscene - Invalid layer item type 'Map Service', expected 'Image Service'

827
4
Jump to solution
11-14-2022 12:42 PM
Tim_McGinnes
Frequent Contributor

I've come across what I believe to be a bug in ArcGIS Javascript API versions 4.16 or greater. I have a simple webscene with elevation layer, basemap and tiled aerial imagery layer. The elevation and aerial imagery were created in Pro using Manage Tiles Cache, then exported to .tpkx, shared with Portal and published through the Portal interface. The web scene works perfectly in the Scene Viewer:

https://gisportal.scc.qld.gov.au/portal/home/webscene/viewer.html?webscene=dd5e07c09fcc4ace9e4559e16... 

However when I load the same webscene using the Javascript API I get an Invalid layer item type 'Map Service', expected 'Image Service' error, and the aerial imagery does not display:

javascript_error.jpg

 

Here's a CodePen showing the error: https://codepen.io/TimMcG/pen/yLEXweG (just using the Load A Basic Web Scene sample, with config for my portal)

If you change the API version to 4.15 it works, but 4.16 or later shows the error.

ArcGIS Enterprise \ Portal version is 10.8.1.

Why it's a bug:

Well, the web scene works perfectly well in Scene Viewer. It's created in the standard way using Pro and Portal - I really can't do anything differently on my side of things. The fault is clearly with the Javascript API being unable to display my scene. And 10.8.1 and 4.16 were released in the same month, so they should work together.

Thanks for any assistance.

0 Kudos
1 Solution

Accepted Solutions
AndreasUlmer
Esri Contributor

Just adding to above reply, which adequately explains the problem.

As far as I can tell from the data, the bug was in SceneViewer 10.8.1, which somehow wrote the wrong layerType into the webscene json. How and why this happened is hard to track down now.
This combination still worked with the less strict API 4.15, but is now "correctly" rejected with API >= 4.16.

As mentioned, one way to fix it is to manually adjust the webscene json
change

 

"layerType": "ArcGISTiledImageServiceLayer"

 

 to

 

"layerType": "ArcGISTiledMapServiceLayer"

 

. This can be done with https://ago-assistant.esri.com/ for example.

 

Option 2, likely simpler: delete and re-add the problematic layer in SceneViewer, and resave the webscene.

View solution in original post

4 Replies
Lerman
by
Frequent Contributor

Yes, this is a bug. It should be the wrong type of this layer recorded in the webscene. Maybe you can go to the \arcgisportal\content\items directory to find the corresponding item of the webscene and modify the content of this item file.

There is no problem with the version before 4.16 because ImageryTileLayer was added in version 4.16. If the layer type is recorded incorrectly on the server side, it affects client-side layer loading from version 4.16 onwards.

AndreasUlmer
Esri Contributor

Just adding to above reply, which adequately explains the problem.

As far as I can tell from the data, the bug was in SceneViewer 10.8.1, which somehow wrote the wrong layerType into the webscene json. How and why this happened is hard to track down now.
This combination still worked with the less strict API 4.15, but is now "correctly" rejected with API >= 4.16.

As mentioned, one way to fix it is to manually adjust the webscene json
change

 

"layerType": "ArcGISTiledImageServiceLayer"

 

 to

 

"layerType": "ArcGISTiledMapServiceLayer"

 

. This can be done with https://ago-assistant.esri.com/ for example.

 

Option 2, likely simpler: delete and re-add the problematic layer in SceneViewer, and resave the webscene.

Tim_McGinnes
Frequent Contributor

Thanks Andreas - that did the trick. Unfortunately whenever you save the web scene it changes it back to ArcGISTiledImageServiceLayer. We are currently upgrading from 10.8.1 to 11 so hopefully that will fix the issue with Scene Viewer.

0 Kudos
AndreasUlmer
Esri Contributor

Thanks for getting back Tim.
Yes, this problem is supposed to be gone with 11. Please let us know in case you still have issues.

0 Kudos