1 Star 0 Fork 0

music过客 / ol-cesium

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-2-Clause

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 you need 2 datasets, see the customProj example.

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);

In addition, you need to expose the Cesium library as window.Cesium. For this, simply add the Cesium script to your html:

<script type="text/javascript" src="..your_path../Cesium.js"></script>

For Cesium integration with Webpack, see ol-cesium-webpack-example.

As an old-fashioned independent library (need update)

  • build the library in dist/olcs.js:
npm i --save olcs
npm run build-library
const ol3d = new olcs.OLCesium({map: ol2dMap}); // ol2dMap is the ol.Map instance
ol3d.setEnabled(true);

For the remaining steps, see the old fashioned example. Notably, you need the Cesium library.

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 'ol-cesium';
const ol3d = new OLCesium({map: ol2dMap}); // ol2dMap is the ol.Map instance
ol3d.setEnabled(true);

In addition, you need to expose the Cesium library as window.Cesium. For this, simply add the Cesium script to your html:

<script type="text/javascript" src="..your_path../Cesium.js"></script>

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

Release process

See RELEASE.md.

Copyright 2014-present, OpenLayers Contributors All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

暂无描述 展开 收起
JavaScript 等 4 种语言
BSD-2-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/musicguoke/ol-cesium.git
git@gitee.com:musicguoke/ol-cesium.git
musicguoke
ol-cesium
ol-cesium
master

搜索帮助