Skip to content

Instantly share code, notes, and snippets.

@bricedev
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bricedev/8db293c9163ef9803c0c to your computer and use it in GitHub Desktop.
Save bricedev/8db293c9163ef9803c0c to your computer and use it in GitHub Desktop.
NA Lambert Conformal Conic

Admin 0 North America projected topojson (Lambert Conformal Conic).

<!DOCTYPE html>
<meta charset="utf-8">
<style>
.countries {
fill: #222;
stroke: #fff;
}
.countries :hover {
fill: #8a8a8a;
}
</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>
var width = 960,
height = 800;
var path = d3.geo.path()
.projection(null);
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("na.json", function(error, na) {
if (error) throw error;
svg.append("g")
.attr("class","countries")
.selectAll("path")
.data(topojson.feature(na, na.objects.countries).features)
.enter().append("path")
.attr("d", path)
.append("title")
.text(function(d) { return d.properties.admin; });
});
d3.select(self.frameElement).style("height", height + "px");
</script>

ogr2ogr
-f 'ESRI Shapefile'
-t_srs 'EPSG:102009'
-where "continent IN ('North America')"
na-projected.shp
ne_50m_admin_0_countries.shp

topojson
--width 960
--height 800
--margin 20
--properties admin
--properties adm0_a3
--properties geounit
-o na.json
-- countries=na-projected.shp

Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment