India Mercator
This visualization displays a map of India with its states and union territories, along with major city labels. It uses a Mercator projection and colors each subunit with a category-based color scale. The code employs D3.js v4 with `d3.geoMercator`, `d3.geoPath`, `d3.scaleOrdinal`, and `d3.schemeCategory20`, alongside TopoJSON for geographic data. Functions automatically center and scale the map to fit the window, draw outer boundaries, subunit boundaries and labels, and place city names from the included `india.json` topology.
AI-generated descriptionDraw a map of India with D3.js, Topojson, and five simple functions:
centerZoom- Automatically centers and scales your map to its container, and returns your map's outer boundaries in case you want to draw them.drawOuterBoundary- Uses the boundary returned fromcenterZoomto draw a boundary around your whole map.drawPlaces- Draws place names, if your topojson has places.drawSubunits- Draws subunits.colorSubunits- Colors the subunits.
This map uses a Mercator projection, and the colors are generated from d3.schemeCategory20. For a tutorial on converting Geojson to Topojson and for finding the coordinates of major cities, see this tutorial.
forked from <a href='http://bl.ocks.org/HarryStevens/'>HarryStevens</a>'s block: <a href='http://bl.ocks.org/HarryStevens/c9cf86eba753ba8650fb466e37d538d2'>India Mercator</a>