Skip to content

Instantly share code, notes, and snippets.

@tomquas
Forked from milafrerichs/eu.topojson
Created February 20, 2020 21:39
Show Gist options
  • Select an option

  • Save tomquas/4db8c682ad2b8609596a13da285ee042 to your computer and use it in GitHub Desktop.

Select an option

Save tomquas/4db8c682ad2b8609596a13da285ee042 to your computer and use it in GitHub Desktop.

Revisions

  1. @milafrerichs milafrerichs revised this gist Mar 10, 2015. 2 changed files with 2 additions and 1 deletion.
    1 change: 1 addition & 0 deletions eu.topojson
    1 addition, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
    2 changes: 1 addition & 1 deletion index.html
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@
    path = d3.geo.path().projection(projection);
    svg = d3.select("#map").append("svg").attr("height", height).attr("width", width);
    countries = svg.append("g");
    d3.json("eu.geojson", function(data) {
    d3.json("eu.topojson", function(data) {
    countries.selectAll('.country')
    .data(topojson.feature(data, data.objects.europe).features)
    .enter()
  2. @milafrerichs milafrerichs created this gist Mar 10, 2015.
    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>
    #map {
    width: 400px;
    height: 300px;
    }
    </style>
    <body>
    <div id="map"></div>
    <script src="http://d3js.org/d3.v3.min.js"></script>
    <script src="http://d3js.org/d3.geo.projection.v0.min.js"></script>
    <script src="http://d3js.org/topojson.v1.min.js"></script>
    <script>
    (function() {
    var center, countries, height, path, projection, scale, svg, width;
    width = 300;
    height = 400;
    center = [5, 70];
    scale = 600;
    projection = d3.geo.mercator().scale(scale).translate([width / 2, 0]).center(center);
    path = d3.geo.path().projection(projection);
    svg = d3.select("#map").append("svg").attr("height", height).attr("width", width);
    countries = svg.append("g");
    d3.json("eu.geojson", function(data) {
    countries.selectAll('.country')
    .data(topojson.feature(data, data.objects.europe).features)
    .enter()
    .append('path')
    .attr('class', 'country')
    .attr('d', path);
    return;
    });
    }).call(this);
    </script>
    </body>
    </html>