GithubHelp home page GithubHelp logo

chengjingfeng / ol-cesium Goto Github PK

View Code? Open in Web Editor NEW

This project forked from openlayers/ol-cesium

0.0 2.0 0.0 16.62 MB

OpenLayers - Cesium integration

Home Page: http://openlayers.org/ol-cesium/

License: BSD 2-Clause "Simplified" License

Makefile 1.57% Shell 0.79% JavaScript 85.50% CSS 12.14%

ol-cesium's Introduction

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

ES6 modules

Since version 2.0, the code is entirely based on ES6 modules and syntax. It requires OpenLayers 5.x. A convenient ES6 package olcs is available on npm.

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);
  • Animated transitions between map and globe view.

The library is configurable and extensible and allows:

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

For synchronization of maps in projections other than EPSG:4326 and EPSG:3857, see #562 branch.

Integration in your application

There are several ways to use OL-Cesium in your application.

As an ES6 library (recommended method)

npm i --save olcs

Then import the parts you need. Example:

import OLCesium from 'olcs/OLCesium.js';
const ol3d = new OLCesium({map: ol2dMap}); // ol2dMap is the ol.Map instance
ol3d.setEnabled(true);

For Cesium integration see ol-cesium-webpack-example based on the official Cesium With Webpack example.

As an old-fashioned independant library

  • build the library in dist/olcs.js:
npm i --save olcs
npm run build-library
  • get the CSS from css/olcs.css;

  • if needed build a full OL5 build;

  • use as follow:

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

In addition, see the old fashioned example.

As an UMD library (Angular, ...)

npm i --save ol-cesium

The UMD-specific build is located here: node_modules/ol-cesium/dist/olcesium.umd.js

Then import the parts you need. Example:

import OLCesium from 'olcs/OLCesium.js';
const ol3d = new OLCesium({map: ol2dMap}); // ol2dMap is the ol.Map instance
ol3d.setEnabled(true);

Going further

See the examples.

If you are new to Cesium, you should also check the Cesium tutorials.

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:3000/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.

  • OpenLayers interactions are not supported in 3d. See openlayers#655.

Release process

See RELEASE.md.

ol-cesium's People

Contributors

ahocevar avatar bkuster avatar dodecaphonic avatar ediebold avatar elemoine avatar fgravin avatar fnicollet avatar fredj avatar gberaudo avatar gjn avatar jacmendt avatar jbo023 avatar jmgomezpoveda avatar klokan avatar mschulz-716 avatar oterral avatar petrsloup avatar poppycocker avatar samuel-girard avatar sbrunner avatar schmidtk avatar tchandelle avatar thomasg77 avatar

Watchers

 avatar  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.