Skip to content

Instantly share code, notes, and snippets.

Last active Mar 1, 2016
What would you like to do?
d3-composite-projections conicConformalPortugal

This file shows how to use the conicConformalPortugal projection from d3-composite-projections. Since the world layer is used, note that the Iberian Peninsula is clipped at the projection border. These projections work well when used at the place they are intended for.

<!DOCTYPE html>
<meta charset="utf-8">
.land {
fill: #222;
.county-boundary {
fill: none;
stroke: #fff;
stroke-width: .5px;
.state-boundary {
fill: none;
stroke: #fff;
.border {
stroke: #000;
fill: none;
<script src=""></script>
<script src=""></script>
<script src=""></script>
var width = 900,
height = 500;
var projection = d3.geo.conicConformalPortugal();
var path = d3.geo.path()
var svg ="body").append("svg")
.attr("width", width)
.attr("height", height);
d3.json("", function(error, world) {
var land = topojson.feature(world, world.objects.countries);
.attr("d", path)
.on("mouseover", function(d,i) {
.style("fill", "red");
.on("mouseout", function(d,i) {
.style("fill", "#aca");
.attr("d", projection.getCompositionBorders());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment