Git Product home page Git Product logo

cesium-starter-app's Introduction

A simple JavaScript starter app for creating apps with Cesium, the open-source WebGL virtual globe and map engine. Just fork this repo and start coding.

Cesium version: b26.

License: Apache 2.0. Free for commercial and non-commercial use. See LICENSE.md.

My primary use for this is to quickly start coding at hackathons without having to setup a repo with a server, Eclipse project, third-party includes, .gitignore, etc. Feel free to overwrite this README.md in your repo with info on your project.

Once you are up and running, copy and paste code examples from Cesium Sandcastle.

What's here?

  • index.html - A simple HTML page based on Cesium's Hello World example. Run a local web server, and browse to index.html to run your app, which will show a 3D globe.
  • Source - Contains App.js which is referenced from index.html. This is where your app's code goes.
  • ThirdParty - A directory for third-party libraries, which initially includes just Cesium. See the Updating Cesium section for how to use the latest version from the Cesium repo.
  • server.js - A simple node.js server for serving your Cesium app. See the Local server section.
  • LICENSE.md - A license file already referencing Cesium as a third-party. This starter app is licensed with Apache 2.0 (free for commercial and non-commercial use). You can, of course, license your code however you want.
  • .project - An Eclipse project with JSHint enabled.
  • .settings - Directory with settings for the Eclipse project.
  • .gitignore - A small list of files not to include in the git repo. Add to this as needed.

Branches

The viewer branch is the same as master except it creates a Viewer widget instead of a CesiumWidget, so it includes the timeline, imagery picker, etc. in addition to the 3D globe.

Local server

A local HTTP server is required to run the app.

Have python installed? If so, from the cesium-starter-app root directory run

python -m SimpleHTTPServer

Browse to http://localhost:8000/

No python? Use Cesium's node.js server.

  • Install node.js
  • From the cesium-starter-app root directory, run
    • npm install connect
    • node server.js

Browse to http://localhost:8000/

Importing into Eclipse

If you use Eclipse as your JavaScript IDE, it is easy to important the cesium-starter-app Eclipse project into a new workspace. In Eclipse:

  • File -> Switch Workspace -> Other
  • Select a directory for the workspace and click OK
  • In Package Explorer, right click and select Import
  • Under General, select Existing Projects into Workspace and click Next
  • Next to Select root directory, click Browse
  • Browse to the cesium-starter-app root directory and click Open
  • Click Finish

Updating Cesium

The built Cesium source is in ThirdParty/Cesium/. I sync this up with the master branch in the Cesium repo once in a while. With cesium and cesium-starter-app repo directories in the same parent directory, here's up to update (replace b25 with the tag/commit to update to):

cd cesium
git pull
git checkout -b b25-starter b25

./Tools/apache-ant-1.8.2/bin/ant clean combine
rm -rf ../cesium-starter-app/ThirdParty/Cesium/*
cp -R Build/Cesium/* ../cesium-starter-app/ThirdParty/Cesium/

Test the starter app in case any changes are needed to index.html or App.js.

Also merge master to viewer so both cesium-starter-app branches are up to date.

git checkout viewer
git merge master
// Change starter app as needed
git push

This uses the unminified version of Cesium.js, which is great for debugging but is quite large for production deployments. To use the minified version, run ant with minify instead of combine before updating cesium-starter-app:

./Tools/apache-ant-1.8.2/bin/ant clean minify

The Cesium Contributor's Guide has more info on Cesium build options.

Cesium resources

Useful hackathon tools

  • jq - command-line JSON processor

cesium-starter-app's People

Contributors

pjcozzi avatar

Watchers

 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.