地图json工程Geojson.io,但它不工作dc.js choropleth地图 [英] map json works on Geojson.io but it doesnt work on dc.js choropleth map
问题描述
我在 geojson.io 上创建了geojson火鸡地图。它工作在geojson.io没有麻烦。但它不工作在
dc.js choropleth地图。
我检查了它与us-states.json
这里我创建的geojson:
没有你的代码,很难回答,但我通常与dc.js choropleth的问题是
1)不使用正确的选择器或键overlayGeoJson yourJson.features,selector,function(d){return d.name;});
- yourJson.features:geo json data (不是topojson)
- selector - 将用于生成css类的图层名称
- 第三个参数 - 用于为地理路径生成密钥,应该匹配维度键(例如,县名,国家的iso ...
使用jQuery / underscore / d3测试您的选择器
2)不定义投影(例如。 mercator)
.projection(d3.geo.mercator())
pre>
3)有错误的缩放/转换
这里的地图是正确绘制的,但不是可见的比例.scale(something)
.translate([x,y]))
但是分享你的代码(最好是在jfiddle),所以我们可以看看它
I created geojson turkey map on geojson.io. It works on geojson.io with no trouble.But it doesnt work on dc.js choropleth map.
I checked it with us-states.json on my codes it works but my geojson map doesnt work.
Here My created geojson:
解决方案Without your code, hard to answer, but the problems I have usually with dc.js choropleth is
1) not using the right selector or key for overlayGeoJson(yourJson.features, "selector", function(d) { return d.name; });
- yourJson.features: geo json data (not topojson)
- "selector" - name of the layer which will be used to generate css class
- 3rd param - (optional) a function used to generate key for geo path, it should match the dimension key (eg. county name, iso of the country...
use jQuery/underscore/d3 to test your selector
2) not defining the projection (eg. mercator)
.projection(d3.geo.mercator())
3) having the wrong scale/transform Here the map is properly drawn, but not in a visible scale
.scale(something)
.translate([x, y]))
But share your code (preferably on jfiddle), so we can have a look at it
这篇关于地图json工程Geojson.io,但它不工作dc.js choropleth地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!