I'm following Mike Bostock's tutorial, let's make a map, but for a map of Mexico. I want to display state boundaries.
I was able to get the map of Mexico from Natural Earth Data's world maps. My source for the state boundaries is here:
http://duopixel.com/LIMITE_ESTATAL.shp
NOTE: this should be the same file as here, but INEGI's server seems to be down for days. I was able to convert it from ogr2ogr into geojson. When you convert from geojson into topojson, this notice comes up:
duopixel$ topojson -s 5 -o estados_simp.json -- estados.json
quantization: maximum error 78.607km (0.707°)
simplification: retained 1130 / 454450 points (0%)
It still seems to generate the file and it looks like it's correct. This is the file it generates. This is my javascript code:
d3.json("estados.json", function(error, mex) {
var estados = mex.objects.estados.geometries
svg.selectAll(".estado")
.data(estados)
.enter().append("path")
.attr("class", "estado")
.attr("d", path)
});
However, I get an error when running this code...
Uncaught TypeError: Cannot read property 'length' of undefined
Now, since I'm not even sure what I'm doing, I have no idea where the failure point is. I'm stuck at this point and any help is appreciated.
-sargument; it takes an area threshold in steradians. A value of 5 steradians is about 40% of the surface of the sphere, which is why it only retained 0% (1130 / 454450) of the input points. For a map of Mexico, you probably want something closer to 1e-8. Alternatively, use--simplify-proportionand specify a value between 0 and 1. See the command line reference for details. – mbostock Mar 10 at 15:49