我正在尝试使用d3js和topojson显示巴基斯坦地图,但地图的尺寸很小,因此无法增加其尺寸。
topojson的网址:https://raw.githubusercontent.com/deldersveld/topojson/master/countries/pakistan/pakistan-provinces.json
我尝试使用音阶并进行翻译,但这没有用。
<meta charset="utf-8">
<style>
path {
fill: none;
stroke: #000;
stroke-width: .5px;
}
</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/queue-async/1.0.7/queue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/topojson/1.6.19/topojson.min.js"></script>
<link href="http://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet" type="text/css">
<script>
var width = 960,
height = 480;
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
var projection = d3.geo.equirectangular()
.scale(153)
.precision(.1);
var path = d3.geo.path()
.projection(projection);
d3.json("pak_map.json", function(error, topology) {
if (error) throw error;
svg.append("path")
.datum(topojson.feature(topology, topology.objects.PAK_adm1))
.attr("d", path)
.attr("class", "land-boundary");
});
</script>
</body>
</html>