Socket
Socket
Sign inDemoInstall

cesium-react

Package Overview
Dependencies
47
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cesium-react

React components for Cesium


Version published
Weekly downloads
20
decreased by-9.09%
Maintainers
1
Install size
767 kB
Created
Weekly downloads
 

Changelog

Source

v0.2.2 - 2018/10/23

New features

  • Viewer: requestRenderMode, maximumRenderTimeChange prop

Chore

  • Upgrade dependencies
  • Update documantation and example
  • Update linter config

Readme

Source

cesium-react

Build Status npm version

React components for 🌏 Cesium

import React from "react";
import { Cartesian3 } from "cesium";
import { Viewer, Entity } from "cesium-react";

export default class Cesium extends React.PureComponent {

  render() {
    return (
      <Viewer full>
        <Entity
          name="tokyo"
          position={Cartesian3.fromDegrees(139.767052, 35.681167, 100)}
          point={{ pixelSize: 10 }}>
          test
        </Entity>
      </Viewer>
    );
  }

}

Screenshot

Available components:

  • <Viewer>
  • <CesiumWidget>
  • <Scene>
  • <Camera>
  • <Entity>
  • <CustomDataSource>
  • <CzmlDataSource>
  • <GeoJsonDataSource>
  • <KmlDataSource>
  • <Primitive>
  • <PointPrimitive>
  • <PointPrimitiveCollection>
  • <ScreenSpaceEvent>
  • <ScreenSpaceEventHandler>
  • <ScreenSpaceCameraController>
  • <ImageryLayer>
  • ...

Documentation

Sorry, no documents now.

Please refer to storybook and examples:

git clone https://github.com/rot1024/cesium-react.git
cd cesium-react
yarn

# run dev server for examples
yarn run examples:dev
# run storybook
yarn run storybook

Getting Started

Typical env: webpack + copy-webpack-plugin + html-webpack-include-assets-plugin

npm i cesium cesium-react --save
npm i copy-webpack-plugin --save-dev
npm i html-webpack-include-assets-plugin --save-dev

webpack.config.js:


const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackIncludeAssetsPlugin = require('html-webpack-include-assets-plugin');

module.exports = {
  externals: {
    cesium: "Cesium"
  },
  output: {
    publicPath: "/"
    // ...
  },
  plugins: {
    new CopyWebpackPlugin([
      {
        from: `node_modules/cesium/Build/Cesium${prod ? "" : "Unminified"}`,
        to: "cesium"
      }
    ]),
    new HtmlWebpackIncludeAssetsPlugin({
      append: false,
      assets: [
        "cesium/Widgets/widgets.css",
        "cesium/Cesium.js"
      ]
    }),
    new webpack.DefinePlugin({
      "process.env": {
        NODE_ENV: JSON.stringify(opts && prod ? "production" : "development"),
        CESIUM_BASE_URL: JSON.stringify("/cesium")
      }
    })
    // ...
  }
  // ...
}

Cesium official way

⚠ Unconfirmed

After the article:

npm i cesium-react
module.exports = {
  // ...
  alias: {
    cesiumSource: "cesium",
    cesium: "cesium/Cesium"
  },
  // ...
}

Then replace as bellow:

import Color from "cesium/Core/Color";

to

import Color from "cesiumSource/Core/Color";

TODO

  • Implement other components (Model, EntityCollection, ParticleSystem, Cesium3DTileset ...)
  • Set up proper prop types
  • More unit tests
  • More documentation
  • More examples

Contributing

Welcome PRs and issues.

License

MIT License

FAQs

Last updated on 23 Oct 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc