Git Product home page Git Product logo

world-atlas's Introduction

[Update 2017/07/13] Add Populated place topojson (also comes from Natural Earth

World Atlas TopoJSON

This repository provides a convenient mechanism for generating TopoJSON files from Natural Earth’s vector data, version 2.0.0.

Usage

In a browser (using d3-geo and Canvas), bl.ocks.org/3783604:

<!DOCTYPE html>
<canvas width="960" height="500"></canvas>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://unpkg.com/topojson-client@3"></script>
<script>

var context = d3.select("canvas").node().getContext("2d"),
    path = d3.geoPath(d3.geoOrthographic(), context);

d3.json("https://unpkg.com/world-atlas@1/world/110m.json", function(error, world) {
  if (error) throw error;

  context.beginPath();
  path(topojson.mesh(world));
  context.stroke();
});

</script>

In Node (using d3-geo and node-canvas), bl.ocks.org/885fffe88d72b2a25c090e0bbbef382f:

var fs = require("fs"),
    d3 = require("d3-geo"),
    topojson = require("topojson-client"),
    Canvas = require("canvas"),
    world = require("./node_modules/world-atlas/world/110m.json");

var canvas = new Canvas(960, 500),
    context = canvas.getContext("2d"),
    path = d3.geoPath(d3.geoOrthographic(), context);

context.beginPath();
path(topojson.mesh(world));
context.stroke();

canvas.pngStream().pipe(fs.createWriteStream("preview.png"));

File Reference

# world/110m.json <>

A TopoJSON topology containing two geometry collections: countries and land. The geometry is quantized, but not projected; it is in spherical coordinates, decimal degrees. This topology is derived from the Natural Earth’s Admin 0 country boundaries, 1:110m small scale, version 2.0.0. The land boundary is computed by merging countries, ensuring a consistent topology.

# world.objects.countries

# world.objects.land

# world/50m.json <>

Equivalent to world/110m.json, but at 1:50m medium scale.

# world.objects.countries

# world.objects.land

world-atlas's People

Contributors

mbostock avatar arvinh avatar bfred-it avatar ccbcreg avatar nobuf avatar tanner avatar

Watchers

 avatar James Cloos 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.