world-atlas
Advanced tools
Comparing version 0.0.3 to 1.0.0
{ | ||
"name": "world-atlas", | ||
"version": "0.0.3", | ||
"description": "Roll your own TopoJSON from Natural Earth.", | ||
"version": "1.0.0", | ||
"description": "Pre-built TopoJSON from Natural Earth.", | ||
"license": "BSD-3-Clause", | ||
"keywords": [ | ||
@@ -12,11 +13,21 @@ "topojson", | ||
"name": "Mike Bostock", | ||
"url": "http://bost.ocks.org/mike" | ||
"url": "https://bost.ocks.org/mike" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/mbostock/world-atlas.git" | ||
"url": "https://github.com/topojson/world-atlas.git" | ||
}, | ||
"scripts": { | ||
"prepublish": "bash prepublish", | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cd ../d3.github.com && git pull && cp ../world-atlas/world/110m.json world-110m.v1.json && cp ../world-atlas/world/50m.json world-50m.v1.json && git add world-110m.v1.json world-50m.v1.json && git commit -m \"world-atlas ${VERSION}\" && git push && cd -" | ||
}, | ||
"devDependencies": { | ||
"topojson": "1" | ||
"d3-dsv": "1", | ||
"d3-geo-projection": "^1.1.1", | ||
"ndjson-cli": "^0.0.5", | ||
"shapefile": "0.5", | ||
"topojson": "2", | ||
"topojson-client": "2", | ||
"topojson-simplify": "2" | ||
} | ||
} |
# World Atlas TopoJSON | ||
This repository provides a convenient mechanism for generating TopoJSON files from [Natural Earth](http://naturalearthdata.com/). | ||
This repository provides a convenient mechanism for generating TopoJSON files from [Natural Earth](http://www.naturalearthdata.com/)’s [vector data](http://www.naturalearthdata.com/downloads/), version 2.0.0. | ||
## Installing via Homebrew | ||
### Usage | ||
Before you can run `make`, you’ll need to install Node.js. Here’s how to do that using [Homebrew](http://mxcl.github.com/homebrew/) on Mac OS X: | ||
In a browser (using [d3-geo](https://github.com/d3/d3-geo) and Canvas), [bl.ocks.org/3783604](https://bl.ocks.org/mbostock/3783604): | ||
```bash | ||
brew install node | ||
``` | ||
```html | ||
<!DOCTYPE html> | ||
<canvas width="960" height="500"></canvas> | ||
<script src="https://d3js.org/d3.v4.min.js"></script> | ||
<script src="https://d3js.org/topojson.v2.min.js"></script> | ||
<script> | ||
And then, from this repository’s root directory, install the dependencies: | ||
var context = d3.select("canvas").node().getContext("2d"), | ||
path = d3.geoPath(d3.geoOrthographic(), context); | ||
```bash | ||
npm install | ||
d3.json("https://d3js.org/world-110m.v1.json", function(error, world) { | ||
if (error) throw error; | ||
context.beginPath(); | ||
path(topojson.mesh(world)); | ||
context.stroke(); | ||
}); | ||
</script> | ||
``` | ||
If you want to install this software using an alternate method see the website for [TopoJSON](https://github.com/mbostock/topojson). I also recommend reading my tutorial, [Let’s Make a Map](http://bost.ocks.org/mike/map/). | ||
In Node (using [d3-geo](https://github.com/d3/d3-geo) and [node-canvas](https://github.com/Automattic/node-canvas)), [bl.ocks.org/885fffe88d72b2a25c090e0bbbef382f](https://bl.ocks.org/mbostock/885fffe88d72b2a25c090e0bbbef382f): | ||
## Generating TopoJSON | ||
```js | ||
var fs = require("fs"), | ||
d3 = require("d3-geo"), | ||
topojson = require("topojson-client"), | ||
Canvas = require("canvas"), | ||
world = require("./node_modules/world-atlas/world/110m.json"); | ||
Once you have everything installed, simply run: | ||
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")); | ||
``` | ||
make | ||
``` | ||
This will generate various TopoJSON files in the `topo` directory. As a by-product of producing these files, you’ll also download the shapefiles directly from Natural Earth and convert them into GeoJSON and filter. | ||
## File Reference | ||
If you want to generate a custom map, I recommend modifying the Makefile. Or, just use the Makefile as a set of examples, and run the appropriate `ogr2ogr` and `topojson` commands from the terminal. | ||
<a href="#world/110m.json" name="world/110m.json">#</a> <b>world/110m.json</b> [<>](https://d3js.org/world-110m.v1.json "Source") | ||
A [TopoJSON *topology*](https://github.com/topojson/topojson-specification/blob/master/README.md#21-topology-objects) containing two geometry collections: <i>countries</i> and <i>land</i>. 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](http://www.naturalearthdata.com/downloads/110m-cultural-vectors/), 1:110m small scale, version 2.0.0. The land boundary is computed by [merging](https://github.com/topojson/topojson-client/blob/master/README.md#merge) countries, ensuring a consistent topology. | ||
<a href="#world/110m.json_countries" name="world/110m.json_countries">#</a> *world*.objects.<b>countries</b> | ||
<img src="https://raw.githubusercontent.com/topojson/world-atlas/master/img/world-110m-countries.png" width="480" height="300"> | ||
<a href="#world/110m.json_land" name="world/110m.json_land">#</a> *world*.objects.<b>land</b> | ||
<img src="https://raw.githubusercontent.com/topojson/world-atlas/master/img/world-110m-land.png" width="480" height="300"> | ||
<a href="#world/50m.json" name="world/50m.json">#</a> <b>world/50m.json</b> [<>](https://d3js.org/world-50m.v1.json "Source") | ||
Equivalent to [world/110m.json](#world/110m.json), but at 1:50m medium scale. | ||
<a href="#world/50m.json_countries" name="world/50m.json_countries">#</a> *world*.objects.<b>countries</b> | ||
<img src="https://raw.githubusercontent.com/topojson/world-atlas/master/img/world-50m-countries.png" width="480" height="300"> | ||
<a href="#world/50m.json_land" name="world/50m.json_land">#</a> *world*.objects.<b>land</b> | ||
<img src="https://raw.githubusercontent.com/topojson/world-atlas/master/img/world-50m-land.png" width="480" height="300"> |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1196946
11
3318
1
75
7