问题
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:
mygeojson
回答1:
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
来源:https://stackoverflow.com/questions/27671784/map-json-works-on-geojson-io-but-it-doesnt-work-on-dc-js-choropleth-map