d3 地图制作

d3中所需的json格式
geometry:几何形状,
geometry-coordinates:就是path的具体内容
geometry-type:形状类型
properties:该path所具有的属性,可以放置我们在图上需要展示的数据
type:类别

{
‘geometry’: {
‘coordinates’: [],
‘type’: ‘Polygon’
},
‘properties’: {
},
‘type’: ‘Feature’
}

var projection = d3.geo.mercator()//.equirectangular()///
    .scale(200) //设定缩放比例
    .translate([width/2, height/2]); //平移
    .rotate([-105,1]) //旋转
    .center([0, 36])  //(坐标)设置地图中心位置

参考文献:
https://www.jianshu.com/p/6b21d35e775d
https://www.jianshu.com/p/27dca8d1bb9b
http://calmhawk.iteye.com/blog/2026798
http://geojson.io/#map=2/45.2/181.1
https://github.com/d3/d3-geo/blob/master/README.md#geoMercator
https://www.oschina.net/translate/geojson-spec?cmp
http://geojson.org/

你可能感兴趣的:(D3)