Is it possible to run the web viewer with local files?

We have received a Cesium dataset from a client as a complete transfer, but the web viewer won’t load the data when we launch the ‘index.html’ file. The following errors are returned:

Any help or advice will be gratefully received. Thanks, Scott

It’s not entirely clear how you started the “web viewer”. Did you just go to https://sandcastle.cesium.com/, or do you start a local instance of CesiumJS?

Also, it is not clear in which form you received the data. I assume that it is a 3D Tiles data set, meaning that it is a directory with a tileset.json file.

In general: When the data should be accessed via a web browser, then it has to be hosted by a server. (The browser basically cannot access local files). This does not mean that this data has to be on the web. You can also host it on a local server.

I actually added some instructions for the 3d-tiles-samples repository recently. You could run the commands that are shown there in the directory that contains the dataset, and should then be able to create a Cesium3DTileset with the corresponding URL.

If this does not help, it could be good to know more about your actual setup, for example, how you are currently running Cesium.

1 Like

Thanks for the detailed instruction and most of this no doubt relates to us receiving data for review that normally resides elsewhere.

However, the sandcastle site looks to be appropriate for us being able to review the data. I managed to get the server running, but it seemed to falter at the last hurdle with the following error displayed in the console when I run the command script.

‘This tileset JSON uses the “content.url” property which has been deprecated. Use “content.uri” instead.’

The server is confirmed as running ( Node.js v16.14.1/ http-server server running @ localhost:8003) and I can navigate the file structure in a standard browser.

I’m hoping that there is a simple enough answer to resolve the error and again appreciate any consideration given to sharing a possible solution. Best regards, Scott

Unfortunately, there are really problems with displaying data in WebViewer - a blank screen and more. I see the solution in determining the platform using the block and using other blocks for Android. For example, for iOS, use the file from asset, and for Android create html-code using the data: protocol.

The message

‘This tileset JSON uses the “content.url” property which has been deprecated. Use “content.uri” instead.’

should only be a warning. It should still work. (I just tried it out by loading one of the 3d-tiles-samples where I manually replaced "uri" with "url" in the tileset.json file).

Are there any further messages on the console? What is the observed behavior? (Just an empty globe being shown?). Which core are you using to display the data in the sandcastle? Could you share some information about the data set, like the directory structure or the top-level tileset.json file? (Of course, testing would be easiest with data set itself, but depending on how large it is, or whether it is confidential, you may not be able to share it, even via mail…)

We’ve done some of this sort of local work using c137.js since it doesn’t need a server. Would have to look at your dataset to see exactly what you need though.

1 Like