Note that there are some explanatory texts on larger screens.

plurals
  1. POD3.js parsing error - rotation of orthogonal map projection
    primarykey
    data
    text
    <p>I have an orthogonal projection of the world map, in D3 and by using TopoJSON. I am coloring the countries with each loading of data by calling this code. The globe rotates constantly. </p> <p>My problem is, that during rotating I get the error message:</p> <h2>Error</h2> <p><b>>> Error: Problem parsing d="" >> in d3.v3.min.js:1</b></p> <p>for each: </p> <pre><code> .attr("d", path); </code></pre> <p>First, I thought that it depends on the topojson script because there are different versions. But it didn't. </p> <h3>javascript code:</h3> <p>init the properties of the globe / projection:</p> <pre><code>svg.append("defs").append("path") .datum({type: "Sphere"}) .attr("id", "sphere") .attr("d", path); ... svg.append("path") .datum(graticule) .attr("class", "graticule") .attr("d", path); </code></pre> <p>read the data from json and tsv and append land and countries:</p> <pre><code>queue() .defer(d3.json, "world-110m.json") .defer(d3.tsv, "world-country-names.tsv") .await(ready); function ready(error, world, names) { var countries = topojson.feature(world, world.objects.countries).features,; i = -1, n = countries.length; countries.forEach(function(d) { var tryit = names.filter(function(n) { return d.id == n.id; })[0]; if (typeof tryit === "undefined"){ d.name = "Undefined"; console.log(d); } else { d.name = tryit.name; } }); var country = svg.selectAll(".country").data(countries); country .enter().insert("path", ".graticule") .attr("id", function(d){ return "c" + d.id; }) .attr("d", path); svg.insert("path", ".graticule") .datum(topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; })) .attr("class", "boundary") .attr("d", path); } </code></pre> <p>rotation of the globe:</p> <pre><code>var velocity = .03, then = Date.now(); d3.timer(function() { var angle = velocity * (Date.now() - then); projection.rotate([angle,0,0]); svg.selectAll("path") .attr("d", path.projection(projection)); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload