Trying to extract topoJSON data

I am trying to follow the instructions given here to create a custom map for Pakistan: https://github.com/markmarkoh/datamaps#you-can-create-any-countrys-map-using-custom-maps

Step 1 - I found Pakistan data in here: https://github.com/markmarkoh/datamaps/tree/master/dist

Step 2 - I don’t understand how to extract the topoJSON data…?
I found Datamap.prototype.PAKTopo json but how do I “extract” it…? Surely they don’t mean copy/paste…??

Thanks!

Extract Datamap.prototype.{xyz}Topo json and save it file named {xyz}.topo.json

You can import the file into your application by referencing it and then parse the data using JSON.parse to turn it into a JavaScript object which you can then reference the data as you see fit.

1 Like

Turns out this library can only be used with d3v3. I will have to figure out another way.