workingdog / cesiumscala   1.6


Scala.js interface to Cesium.js

Scala versions: 2.11
Scala.js versions: 0.6

Scala.js interface to Cesium.js

Cesium is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for hardware-accelerated graphics, and is cross-platform, cross-browser, and tuned for dynamic-data visualization.

This library, cesiumscala, is a Scala.js façade to Cesium.js for client side development. Cesium client applications can now be written in Scala and compiled into javascript using Scala.js.

There are also the Scala libraries; ScalaCZML and ScalaKml for server side development.


To use the last release (compatible with Cesium 1.30) add the following dependency to your build.sbt:

libraryDependencies += "com.github.workingDog" %%% "cesiumscala" % "1.6"

To run the basic CesiumApp you can install and run Cesium.js locally. Refer to Cesium tutorial for how to install and launch Cesium.

Typical steps to run CesiumApp:

  • Download and install Cesium.
  • Compile and generate cesiumscala, using "sbt fullOptJS". This will generate "cesiumscala-opt.js" in the "./target/scala-2.11" directory.
  • Put "CesiumScala.html" and "cesiumscala-opt.js" files in the "Cesium/Apps" directory and
  • launch Cesium (e.g. "node server.js").
  • Then point your browser to http://localhost:8080/Apps/CesiumScala.html

A 3D world globe with an aircraft and various shapes should be displayed in your browser. If the globe is not showing, you may need to get a Bing Map key and put it in the CesiumScala.html.

This library makes extensive use of jsext JSOptionBuilder for defining "options" objects. Here these objects are named "class-name + Options". For example:

class ModelGraphics(options: ModelGraphicsOptions)

See the example CesiumApp and Using the JSOptionBuilder documentation to learn how to define these "options" objects using jsext.

Compiling, packaging and publishing

To compile and generate a javascript file from the source code:

sbt fullOptJS 

The javascript file (cesiumscala-opt.js) will be in the "./target/scala-2.11" directory.

To publish cesiumscala to your local (Ivy) repository, simply type:

sbt publishLocal

Then put this in your build.sbt

libraryDependencies += "com.github.workingDog" %%% "cesiumscala" % "1.7-SNAPSHOT"

Dependencies code inclusions

The code from jsext relating to JSOptionBuilder is used in cesiumscala and is included here (verbatim) rather than as an external dependency.

cesiumscala also depends on scala-js-dom, see also build.sbt.


  1. Scala.js

  2. Cesium

  3. scala-js-ts-importer

  4. JSDoc


Scaladoc documentations can be generated by typing:

sbt doc

Refer to Cesium API reference for the original Cesium documentation.


cesiumscala is licensed under the terms of the Apache v2.0 license.


usable, ongoing work