Git Product home page Git Product logo

ol-cesium's Introduction

Ol-Cesium

OpenLayers - Cesium integration library. Create your map using OpenLayers, and visualize it on a globe with Cesium. See live examples.

Features

Switch smoothly between 2D and 3D and synchronize:

  • Map context (bounding box and zoom level);
  • Raster data sources;
  • Vector data sources in 2D and 3D;
  • Map selection (selected items).

The library is configurable and extensible and allows:

  • Lazy or eager loading of Cesium
  • Limiting Cesium resource consumption (idle detection)

Stay tuned for more exciting features like animated transitions between map and globe view, and synchronization of maps in projections other than EPSG:4326 and EPSG:3857.

Getting started

To obtain Ol-Cesium, either download a release from https://github.com/openlayers/ol-cesium/releases, or clone the repository and build it yourself (see below).

Applications using Ol-Cesium also need to load OpenLayers styles and Cesium resources (included in the distribution):

<link rel="stylesheet" href="ol.css" type="text/css">
<script src="Cesium/Cesium.js"></script>
<script src="olcesium.js"></script>

An OpenLayers map can be switched to a 3d globe view by running the code below after the map has been created:

var ol3d = new olcs.OLCesium({map: map}); // map is the ol.Map instance
ol3d.setEnabled(true);

The above will use the WGS84 ellipsoid all around the globe. To use terrain, simply add a terrain provider using the Cesium API (can be your own, but in the snippet below it's one that ships with Cesium):

var ol3d = new olcs.OLCesium({map: map}); // map is the ol.Map instance
var scene = ol3d.getCesiumScene();
scene.terrainProvider = new Cesium.CesiumTerrainProvider({
  url: 'https://assets.agi.com/stk-terrain/world'
});
ol3d.setEnabled(true);

Building the library

Requirements for building Ol-Cesium:

To get started, clone the Ol-Cesium repository with its submodules:

$ git clone --recursive https://github.com/openlayers/ol-cesium.git

Change into the clone directory, and invoke

$ make dist

from the root of the repository. You will then be able to use dist/olcesium.js for your applications.

Running the examples in debug mode

This is useful for contributing to Ol-Cesium, because it loads the source files instead of a minified build:

$ make serve

will make the distribution examples available at http://localhost:4000/examples

Running the unminified version of Cesium

Passing the parameter ?mode=dev to an example will load the debug version of Cesium instead of the minified one. This is helpful when something breaks inside Cesium. In distribution mode, an unminified version of OpenLayers and Ol-Cesium is also loaded.

Limitations

OpenLayers unmanaged layers are not discoverable and as a consequence not supported. Plain layers should be used instead or the synchronization managed manually. See openlayers#350.

Release process

See RELEASE.md.

ol-cesium's People

Contributors

gberaudo avatar petrsloup avatar fredj avatar ahocevar avatar elemoine avatar klokan avatar schmidtk avatar gjn avatar jacmendt avatar jbo023 avatar jmgomezpoveda avatar thomasg77 avatar oterral avatar poppycocker avatar

Watchers

James Cloos avatar GISer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.