🌎 Awesome interactive globes for the web
Go to file
2013-12-28 16:18:09 -08:00
dist v1.0.0-rc.2 2013-12-25 23:30:59 -08:00
script Add script to set version number 2013-12-28 13:09:12 -08:00
site (site) Add link to release notes and tree/tag from download page 2013-12-28 13:07:02 -08:00
src (topojson) Recreate world-110m.json with topojson utility to decrease file size 2013-12-26 15:27:11 -08:00
.gitignore First pass at implementation 2013-12-20 23:58:16 -08:00
bower.json Add script to set version number 2013-12-28 13:09:12 -08:00
CHANGELOG.md v1.0.0-rc.2 2013-12-25 23:30:59 -08:00
gulpfile.js (core) Ensure built files use newlines everywhere 2013-12-28 13:02:54 -08:00
LICENSE Add license 2013-12-21 11:07:16 -08:00
package.json Add 'main' entry to package.json 2013-12-28 16:18:09 -08:00
README.md (site) Add download page 2013-12-25 17:06:38 -08:00
screenshot.png Flesh out readme 2013-12-19 21:31:19 -08:00

Planetary.js

Planetary.js is a JavaScript library for building awesome interactive globes, like this one:

Planetary.js Screenshot

Planetary.js is based on D3.js and TopoJSON. It has built-in support for zoom, rotation, mouse interaction, and displaying animated "pings" at any coordinate. Via plugins, Planetary.js can be extended to do whatever you want!

Examples, documentation, and more can be found at planetaryjs.com.

Requirements

Download

Download Planetary.js from the Planetary.js web site.

Quick Start

You'll need to run this page from a web server of some kind so that Planetary.js can load the TopoJSON data via Ajax.

HTML:

<html>
<head>
  <script type='text/javascript' src='http://d3js.org/d3.v3.min.js'></script>
  <script type='text/javascript' src='http://d3js.org/topojson.v1.min.js'></script>
  <script type='text/javascript' src='planetaryjs.min.js'></script>
</head>
<body>
  <canvas id='globe' width='500' height='500'></canvas>
  <script type='text/javascript' src='yourApp.js'></script>
</body>
</html>

JavaScript (yourApp.js):

var planet = planetaryjs.planet();
// You can remove this statement if `world-110m.json`
// is in the same path as the HTML page:
planet.loadPlugin(planetaryjs.plugins.earth({
  topojson: { file: 'http/path/to/world-110m.json' }
}));
// Make the planet fit well in its canvas
planet.projection.scale(250).translate([250, 250]);
var canvas = document.getElementById('globe');
planet.draw(canvas);

Congratulations! You've rendered your first globe.

Documentation

In-depth documentation can be found at planetaryjs.com.

Building

Building the project requires Node.js. Once you've installed the project's dependencies with npm install, you can build the JavaScript to the dist directory with npm run build.

License

Planetary.js is licensed under the MIT license. See the LICENSE file for more information.