Abhishek
Abhishek

Reputation: 2945

Ol3-Cesium Example not working when run from local PC

I can view the OL3-Cesium examples from the website online perfectly.

When I view this example, I get the 3D view when I click on enable/disable button.

Now I have downloaded the release folder. When I try to view the same example from the examples folder, the example does not work the same.

This is the output when I open main.html from my system:

enter image description here

I don't know if I am missing something here

Upvotes: 1

Views: 850

Answers (1)

Matthew Amato
Matthew Amato

Reputation: 2022

The overall problem is that you are running the example directly from the filesystem. The directory needs to be hosted under a web server, even the most basic server will do. For example, if you have python installed, just run python -m SimpleHTTPServer in the root and browse to http://localhost:8000/.

The exact problem you are seeing is that the default imagery provider is configured to use the same URI protocol as the site being visited, i.e. if you are at an http site, it uses http. If you are at https, it uses https. Since you opened directly from disk, you are using file://, which causes the imagery to try and use file:// as well. Since you have no such imagery on your system nothing shows up in the globe.

It is technically possible to use Cesium and Open Layers completely offline, but care must be taken and it looks like that example was not written with it in mind.

Upvotes: 3

Related Questions