-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in topojson feature datum #27
Comments
Try |
I tried
Now it shows a black screen and gives this error: Is this a mistake from d3.js or are there still mistakes inside my code? |
The generated topojson files contain projected coordinates by default. Please read https://github.com/interactivethings/swiss-maps#projections-and-dimensions for an explanation. This should work: d3.json("tg-municipalities-lakes.json", function(error, tg) {
if (error) return console.error(error);
// Use null projection because coordinates are already projected
var geoPath = d3.geo.path().projection(null);
svg.append("path")
.datum(topojson.feature(tg, tg.objects.municipalities))
.attr("d", geoPath);
}); |
Also, you don't need |
Great, thanks for your help. |
Hi, I'm programming a map with d3.js, that should display the canton Thurgau. Unfortunately, It gives an error:
Uncaught TypeError: Cannot read property 'type' of undefined at Object.p [as feature] (topojson.v1.min.js:2) at localhost/:46 at Object.<anonymous> (d3.v3.min.js:1) at Object.t (d3.v3.min.js:1) at XMLHttpRequest.i (d3.v3.min.js:1)
I've made an json file with :
make topo/ch-cantons.json PROPERTIES=Thurgau,tg
and there is my json code:
Can you help me with this?
The text was updated successfully, but these errors were encountered: