Europe projection
Last active
August 29, 2015 14:24
-
-
Save bricedev/b485239a37ca57722603 to your computer and use it in GitHub Desktop.
Europe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<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> | |
var width = 960, | |
height = 700; | |
var projection = d3.geo.conicConformal() | |
.rotate([-10, 0]) | |
.center([0, 53]) | |
.parallels([29.5, 45.5]) | |
.scale(1100) | |
.translate([width / 2, height / 2]); | |
var path = d3.geo.path() | |
.projection(projection); | |
var svg = d3.select("body").append("svg") | |
.attr("width", width) | |
.attr("height", height); | |
d3.json("europe.json", function(error, europe) { | |
if (error) throw error; | |
console.log(europe); | |
svg.selectAll(".countries") | |
.data(topojson.feature(europe, europe.objects.countries).features) | |
.enter().append("path") | |
.attr("class", "countries") | |
.style("fill", "#e2e2e2") | |
.style("stroke","#9a9a9a") | |
.style("stroke-width","0.3px") | |
.attr("d", path); | |
}); | |
d3.select(self.frameElement).style("height", height + "px"); | |
</script> |
ogr2ogr
-f GeoJSON
-where "Continent IN ('Europe')"
countries.json
ne_10m_admin_0_countries.shp
topojson
-o topoeurope.json
--id-property SU_A3
--
countries.json
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment