In my previous post d3-map-of-india I spoke about creating a map of India using D3. In this post am going to talk about creating a map of a specific state of India.
Am going to create a map of Rajasthan in this article. Maps of all other states can be created following the same steps.
Follow Steps 1 to 4 remain as explained in d3-map-of-india
Now we extract the data for the state for which we want to build the map, from the SHAPE data for INDIA, in JSON format.
Open Terminal and go to the IND_ADM folder (see steps 1 to 5 in d3-map-of-india ) and run the following command line :
ogr2ogr -f GeoJSON -where “NAME_1 IN (‘Rajasthan’)” raj.json IND_adm1.shp
This will generate the json data for State of Rajasthan. (Similarly you can generate the JSON data for other states of India)
Now you are ready to use this json file with D3 to create the map of Rajasthan.
Download the code from