Open ndarville opened 9 years ago
Threshold done in ecfe2346d48f8f3b45bd993cb977cbf27d4c9901.
TopoJSON removes all properties by default, so you have to explicitly define them.
Using http://geojson.io keeps all the data.
Turns out that when going from GeoJSON to TopoJSON, you can’t do this:
- json.features
+ json.objects.collection.geometries
Instead, you have to use
- json.features
+ topojson.feature(json, json.objects.collection).features
Because the path
function will return an error in the first instance. Here is the different result between the two:
- >console.log(json.objects.collection.geometries[0]);
- Object {type: "Polygon", properties: Object, arcs: Array[1]}
+ >console.log(topojson.feature(json, json.objects.collection).features[0]);
+ Object {type: "Feature", properties: Object, geometry: Object}
You can access properties
in both instances; the rest, not so much.
Generalize the topojson
script instead of relying on http://geojson.io.
topojson input.geojson \
-o output.topojson \
-p name_sort scalerank \
--bbox
Example links:
name_sort
,subunit
, etc.Mike Bostock’s “Let’s Make a Map” tutorial.
Ditched the gradient threshold.