I use d3 version 4.0.0. and topojson.min.js to produce a map using german topo json data. I achieved to get the map on the browser however map appears very small.
I tried many ways to scale it but could not achieve to enlarge the size of the map.
I tried scaling with 1)command line tool, 2)in code and 3)in json data but none of them worked for me.
- I tried command line tool as below but it produces file with null
geoproject 'd3.geoAlbers().center([0, 54.4]).rotate([4.4, 0]).parallels([50, 60]).scale(1200 * 3).translate([960 / 2, 600 / 2])' < germany.json > germany_scaled1.json
- I tried same thing directly in the code with many ways but didnt work. For example below code gives undefined error for geo
var projection = d3.geoAlbers().parallels([50, 60]).translate([960 / 2, 600 / 2]).center([0, 54.4]).scale(1200 * 200) var path = d3.geo.path().projection(projection);
// this is for render the map
var update = svg.selectAll('path')
.data(topoData)
var enter = update.enter()
.append('path')
update.merge(enter)
.attr('d', path) //d3.geoPath())
.attr('fill', function(d) {
return d3.interpolateBuGn(d.matchesPercent / maxMatch + 0.2);
});
- I also tried same thing directly in json file with Transform but it did not work either
added this "transform":{"scale":[5.0,5.00],"translate":[80.0,30.00],"center":[0.0,54.4]}
I hope someone will help me to scale my map