Creating map of Africa using d3.js and topoJSON

不问归期 提交于 2019-12-06 09:28:36

Your topojson is not in WGS84, that is to say lat/long coordinate space or unprojected data. D3.projection() requires WGS84.

Your topojson is already projected in, what I assume is, the Africa Lambert Conformal Conic projection. You do not need to use a projection to display this in d3.js. In order to display this data without a projection you can define the projection of your geoPath as:

path = d3.geoPath().projection(null);

This is how the topojson was projected in the block in which that data came from.

If you need to scale or translate the projection, then d3.geoTransform can help you, see this block.

Alternatively, you can reproject your topojson so that it uses lat/long pairs and will properly project using d3.projection().

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!