Convert Figma logo to code with AI

CesiumGS logocesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:

12,690
3,442
12,690
1,385

Top Related Projects

101,622

JavaScript 3D Library.

12,182

WebGL2 powered visualization framework

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL

OpenLayers

41,217

πŸƒ JavaScript library for mobile-friendly interactive maps πŸ‡ΊπŸ‡¦

10,250

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

Quick Overview

Cesium is an open-source JavaScript library for creating 3D globes and maps. It provides a powerful platform for visualizing geospatial data, offering both 2D and 3D views with support for various data formats and real-time dynamic scenes.

Pros

  • High-performance rendering of 3D globes and maps
  • Supports a wide range of geospatial data formats
  • Extensive documentation and active community support
  • Cross-platform compatibility (works on desktop and mobile browsers)

Cons

  • Steep learning curve for beginners
  • Large file size can impact initial load times
  • Limited customization options for some built-in widgets
  • Performance can be affected when handling very large datasets

Code Examples

  1. Creating a basic 3D globe:
const viewer = new Cesium.Viewer('cesiumContainer');
  1. Adding a 3D model to the scene:
const entity = viewer.entities.add({
  position: Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
  model: {
    uri: 'path/to/model.glb'
  }
});
viewer.zoomTo(entity);
  1. Creating a custom data source and adding it to the viewer:
const customDataSource = new Cesium.CustomDataSource('myData');
customDataSource.entities.add({
  position: Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883),
  point: {
    pixelSize: 10,
    color: Cesium.Color.RED
  }
});
viewer.dataSources.add(customDataSource);

Getting Started

  1. Include Cesium in your HTML file:
<script src="https://cesium.com/downloads/cesiumjs/releases/latest/Build/Cesium/Cesium.js"></script>
<link href="https://cesium.com/downloads/cesiumjs/releases/latest/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
  1. Create a container for the Cesium viewer:
<div id="cesiumContainer" style="width: 100%; height: 400px;"></div>
  1. Initialize the Cesium viewer in your JavaScript code:
const viewer = new Cesium.Viewer('cesiumContainer', {
  terrainProvider: Cesium.createWorldTerrain()
});

This will create a basic 3D globe with terrain data. You can then add your own data sources, entities, and customize the viewer as needed.

Competitor Comparisons

101,622

JavaScript 3D Library.

Pros of Three.js

  • More versatile for general 3D graphics and animations
  • Larger community and ecosystem of plugins/extensions
  • Lighter weight and faster for non-geospatial applications

Cons of Three.js

  • Lacks built-in geospatial features and globe rendering
  • No native support for terrain or imagery layers
  • Less optimized for large-scale geographic visualizations

Code Comparison

Three.js basic scene setup:

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

Cesium basic scene setup:

const viewer = new Cesium.Viewer('cesiumContainer', {
  terrainProvider: Cesium.createWorldTerrain()
});
viewer.scene.globe.enableLighting = true;
viewer.camera.flyTo({destination: Cesium.Cartesian3.fromDegrees(-122.4, 37.8, 5000)});

Three.js is more suitable for general 3D graphics and animations, while Cesium excels in geospatial visualizations and globe rendering. Three.js offers a larger community and ecosystem, but Cesium provides built-in support for geographic data and terrain visualization. The choice between the two depends on the specific requirements of the project, particularly whether geospatial features are needed.

12,182

WebGL2 powered visualization framework

Pros of deck.gl

  • Lightweight and modular architecture, allowing for easier integration and customization
  • Extensive support for 2D and 3D data visualization, including geospatial layers
  • Optimized for rendering large datasets with WebGL

Cons of deck.gl

  • Less comprehensive 3D globe and terrain rendering capabilities
  • Limited built-in support for time-dynamic data and animations
  • Smaller ecosystem and community compared to Cesium

Code Comparison

deck.gl:

import {Deck} from '@deck.gl/core';
import {GeoJsonLayer} from '@deck.gl/layers';

new Deck({
  layers: [new GeoJsonLayer({id: 'geojson', data: GEOJSON_DATA})]
});

Cesium:

const viewer = new Cesium.Viewer('cesiumContainer');
viewer.dataSources.add(Cesium.GeoJsonDataSource.load(GEOJSON_DATA));

Both libraries offer ways to visualize geospatial data, but deck.gl provides a more modular approach with customizable layers, while Cesium offers a more integrated 3D globe experience out of the box. deck.gl excels in 2D and 3D data visualization with its flexible architecture, making it easier to integrate into existing web applications. However, Cesium provides more comprehensive 3D globe and terrain rendering capabilities, along with better support for time-dynamic data and animations. The choice between the two depends on the specific requirements of your project, such as the need for a full 3D globe experience versus lightweight, customizable data visualization.

Interactive, thoroughly customizable maps in the browser, powered by vector tiles and WebGL

Pros of mapbox-gl-js

  • Optimized for 2D mapping and high-performance vector tile rendering
  • Extensive styling options and customization capabilities
  • Robust ecosystem with numerous plugins and integrations

Cons of mapbox-gl-js

  • Limited 3D capabilities compared to Cesium's full 3D globe
  • Requires Mapbox account and API key for some features
  • Less suitable for scientific and geospatial applications

Code Comparison

mapbox-gl-js:

mapboxgl.accessToken = 'YOUR_ACCESS_TOKEN';
const map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/streets-v11',
  center: [-74.5, 40],
  zoom: 9
});

Cesium:

const viewer = new Cesium.Viewer('cesiumContainer', {
  terrainProvider: Cesium.createWorldTerrain(),
  imageryProvider: Cesium.createWorldImagery()
});
viewer.camera.flyTo({
  destination: Cesium.Cartesian3.fromDegrees(-74.5, 40, 1000000)
});

Summary

mapbox-gl-js excels in 2D mapping with high-performance vector tiles and extensive styling options. It's ideal for web-based mapping applications but has limited 3D capabilities. Cesium, on the other hand, offers a full 3D globe experience and is better suited for scientific and geospatial applications. The choice between the two depends on the specific requirements of your project, such as the need for 3D visualization, performance considerations, and the type of data you're working with.

OpenLayers

Pros of OpenLayers

  • Simpler learning curve and easier to get started with for basic 2D mapping
  • More lightweight and faster for 2D map rendering
  • Better support for various vector data formats and OGC standards

Cons of OpenLayers

  • Limited 3D capabilities compared to Cesium's robust 3D globe and terrain support
  • Less extensive set of plugins and add-ons for advanced visualization features
  • Smaller community and fewer enterprise-level implementations

Code Comparison

OpenLayers:

import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';

const map = new Map({
  layers: [new TileLayer({ source: new OSM() })],
  target: 'map',
  view: new View({ center: [0, 0], zoom: 2 })
});

Cesium:

const viewer = new Cesium.Viewer('cesiumContainer', {
  terrainProvider: Cesium.createWorldTerrain(),
  imageryProvider: new Cesium.OpenStreetMapImageryProvider({
    url: 'https://a.tile.openstreetmap.org/'
  })
});
viewer.scene.globe.enableLighting = true;

Both libraries offer powerful mapping capabilities, but OpenLayers excels in 2D mapping with simpler implementation, while Cesium provides advanced 3D globe visualization. The choice between them depends on project requirements and the desired level of 3D functionality.

41,217

πŸƒ JavaScript library for mobile-friendly interactive maps πŸ‡ΊπŸ‡¦

Pros of Leaflet

  • Lightweight and fast, with a smaller file size
  • Simpler API and easier to learn for basic 2D mapping
  • Extensive plugin ecosystem for added functionality

Cons of Leaflet

  • Limited 3D capabilities
  • Less suitable for complex geospatial visualizations
  • Fewer built-in features for advanced data rendering

Code Comparison

Leaflet:

var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
L.marker([51.5, -0.09]).addTo(map)
    .bindPopup('A sample marker.')
    .openPopup();

Cesium:

var viewer = new Cesium.Viewer('cesiumContainer');
viewer.camera.flyTo({
    destination: Cesium.Cartesian3.fromDegrees(-122.4175, 37.655, 400),
    orientation: {
        heading: Cesium.Math.toRadians(0.0),
        pitch: Cesium.Math.toRadians(-15.0),
    }
});

Leaflet excels in simplicity and lightweight 2D mapping, while Cesium offers powerful 3D globe visualization capabilities. Leaflet's code is more straightforward for basic mapping tasks, whereas Cesium provides more advanced features for complex geospatial applications.

10,250

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

Pros of Kepler.gl

  • Focused on geospatial data visualization with an intuitive UI
  • Supports various data formats and easy data import/export
  • Highly customizable with a wide range of map styles and layer types

Cons of Kepler.gl

  • Limited 3D capabilities compared to Cesium's robust 3D globe
  • Less suitable for real-time data streaming and large-scale terrain rendering
  • Smaller community and ecosystem than Cesium

Code Comparison

Kepler.gl (React-based):

import KeplerGl from 'kepler.gl';

const Map = () => (
  <KeplerGl
    id="map"
    width={800}
    height={600}
    mapboxApiAccessToken={MAPBOX_TOKEN}
  />
);

Cesium (JavaScript):

const viewer = new Cesium.Viewer('cesiumContainer', {
  terrainProvider: Cesium.createWorldTerrain(),
  imageryProvider: new Cesium.ArcGisMapServerImageryProvider({
    url: 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer'
  })
});

Both libraries offer powerful mapping capabilities, but Kepler.gl excels in data visualization and user-friendly interfaces, while Cesium provides superior 3D globe functionality and terrain rendering. Kepler.gl is ideal for creating interactive, data-driven maps, whereas Cesium is better suited for complex 3D geospatial applications and simulations.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

CesiumJS

Build Status npm Docs

Cesium

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

Built on open formats, CesiumJS is designed for robust interoperability and scaling for massive datasets.


Examples :earth_asia: Docs :earth_americas: Website :earth_africa: Forum :earth_asia: User Stories


:rocket: Get started

Visit the Downloads page to download a pre-built copy of CesiumJS.

npm & yarn

If youҀ™re building your application using a module bundler such as Webpack, Parcel, or Rollup, you can install CesiumJS via the cesium npm package:

npm install cesium --save

Then, import CesiumJS in your app code. Import individual modules to benefit from tree shaking optimizations through most build tools:

import { Viewer } from "cesium";
import "cesium/Build/Cesium/Widgets/widgets.css";

const viewer = new Viewer("cesiumContainer");

In addition to the cesium package, CesiumJS is also distributed as scoped npm packages for better dependency management:

What next?

See our Quickstart Guide for more information on getting a CesiumJS app up and running.

Instructions for serving local data are in the CesiumJS Offline Guide.

Interested in contributing? See CONTRIBUTING.md. :heart:

:green_book: License

Apache 2.0. CesiumJS is free for both commercial and non-commercial use.

:earth_americas: Where does the Global 3D Content come from?

The Cesium platform follows an open-core business model with open source runtime engines such as CesiumJS and optional commercial subscription to Cesium ion.

CesiumJS can stream 3D content such as terrain, imagery, and 3D Tiles from the commercial Cesium ion platform alongside open standards from other offline or online services. We provide Cesium ion as the quickest option for all users to get up and running, but you are free to use any combination of content sources with CesiumJS that you please.

Bring your own data for tiling, hosting, and streaming from Cesium ion. Using Cesium ion helps support CesiumJS development.

:white_check_mark: Features

  • Stream in 3D Tiles and other standard formats from Cesium ion or another source
  • Visualize and analyze on a high-precision WGS84 globe
  • Share with users on desktop or mobile

See more in the CesiumJS Features Checklist.

NPM DownloadsLast 30 Days