Skip to content

Instantly share code, notes, and snippets.

@mbostock
Last active February 1, 2020 08:29
Show Gist options
  • Save mbostock/5996232 to your computer and use it in GitHub Desktop.
Save mbostock/5996232 to your computer and use it in GitHub Desktop.

Revisions

  1. mbostock revised this gist Feb 9, 2016. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions .block
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    license: gpl-3.0
  2. mbostock revised this gist Oct 31, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -12,8 +12,8 @@

    </style>
    <body>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.19/topojson.min.js"></script>
    <script src="//d3js.org/d3.v3.min.js"></script>
    <script src="//d3js.org/topojson.v1.min.js"></script>
    <script>

    var width = 960,
  3. mbostock revised this gist Jun 11, 2015. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -12,8 +12,8 @@

    </style>
    <body>
    <script src="http://d3js.org/d3.v3.min.js"></script>
    <script src="http://d3js.org/topojson.v1.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.19/topojson.min.js"></script>
    <script>

    var width = 960,
    @@ -27,6 +27,8 @@
    .attr("height", height);

    d3.json("ny.json", function(error, ny) {
    if (error) throw error;

    svg.append("path")
    .datum(topojson.mesh(ny))
    .attr("d", path);
  4. mbostock revised this gist Jul 15, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    13,837 census block groups; 13,866 polygons. 2.1M TopoJSON, 468K gzipped. Made by customizing the makefile in the [U.S. Atlas project](https://github.com/mbostock/us-atlas):
    13,837 census block groups; 13,866 polygons. 2.1M TopoJSON, 620K gzipped. Made by customizing the makefile in the [U.S. Atlas project](https://github.com/mbostock/us-atlas):

    ```bash
    topojson \
  5. mbostock revised this gist Jul 15, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ny.json
    1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
  6. mbostock revised this gist Jul 14, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@
    .attr("width", width)
    .attr("height", height);

    d3.json("ny2.json", function(error, ny) {
    d3.json("ny.json", function(error, ny) {
    svg.append("path")
    .datum(topojson.mesh(ny))
    .attr("d", path);
  7. mbostock revised this gist Jul 14, 2013. 3 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -26,7 +26,7 @@
    .attr("width", width)
    .attr("height", height);

    d3.json("ny.json", function(error, ny) {
    d3.json("ny2.json", function(error, ny) {
    svg.append("path")
    .datum(topojson.mesh(ny))
    .attr("d", path);
    2 changes: 1 addition & 1 deletion ny.json
    1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
    Binary file added thumbnail.png
    Loading
    Sorry, something went wrong. Reload?
    Sorry, we cannot display this file.
    Sorry, this file is invalid so it cannot be displayed.
  8. mbostock revised this gist Jul 14, 2013. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@

    d3.json("ny.json", function(error, ny) {
    svg.append("path")
    .datum(topojson.feature(ny, ny.objects.blockgroups))
    .datum(topojson.mesh(ny))
    .attr("d", path);
    });

    2 changes: 1 addition & 1 deletion ny.json
    1 addition, 1 deletion not shown because the diff is too large. Please use a local Git client to view these changes.
  9. mbostock created this gist Jul 14, 2013.
    10 changes: 10 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    13,837 census block groups; 13,866 polygons. 2.1M TopoJSON, 468K gzipped. Made by customizing the makefile in the [U.S. Atlas project](https://github.com/mbostock/us-atlas):

    ```bash
    topojson \
    -o ny.json \
    --projection 'd3.geo.mercator().center([-75.819, 42.795]).scale(6193).translate([480, 350]).precision(0)' \
    -q 1e5 \
    -s .5 \
    -- blockgroups=shp/ny/blockgroups.shp
    ```
    37 changes: 37 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    <!DOCTYPE html>
    <meta charset="utf-8">
    <style>

    path {
    fill: none;
    stroke: #000;
    stroke-width: .5px;
    stroke-linejoin: round;
    stroke-linecap: round;
    }

    </style>
    <body>
    <script src="http://d3js.org/d3.v3.min.js"></script>
    <script src="http://d3js.org/topojson.v1.min.js"></script>
    <script>

    var width = 960,
    height = 700;

    var path = d3.geo.path()
    .projection(null);

    var svg = d3.select("body").append("svg")
    .attr("width", width)
    .attr("height", height);

    d3.json("ny.json", function(error, ny) {
    svg.append("path")
    .datum(topojson.feature(ny, ny.objects.blockgroups))
    .attr("d", path);
    });

    d3.select(self.frameElement).style("height", height + "px");

    </script>
    1 change: 1 addition & 0 deletions ny.json
    1 addition, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.