Skip to main content

API Documentation

Getting Started

This document provides a brief introduction to using the IIPMaps API.

The base URL for the API is https://iipmaps-api.vercel.app.

Map Generation

To generate a map, you need to send a POST request to {{baseurl}}/api/generate-map with the following data structure:

{
"mapName": "india",
"size": 1200,
"data": {
"Andhra Pradesh": 6084.7,
"Arunachal Pradesh": 17.41,
"Assam": 4196.92,
"Bihar": 17575.4,
"Chhattisgarh": 6854.34,
"Gujarat": 13980.29,
"Haryana": 5883.87,
"Himachal Pradesh": 1875.24,
"Jammu & Kashmir": 1339.12,
"Jharkhand": 3734.08,
"Karnataka": 7517.63,
"Kerala": 2802.44,
"Madhya Pradesh": 21247.25,
"Maharashtra": 13882.96,
"Manipur": 339.87,
"Meghalaya": 517.76,
"Mizoram": 191.45,
"Nagaland": 456.24,
"Odisha": 9510.49,
"Punjab": 5856.37,
"Rajasthan": 2119.66,
"Sikkim": 138.2,
"Tamilnadu": 9182.78,
"Telangana": 1943.53,
"Tripura": 847.72,
"Uttar Pradesh": 29160.88,
"Uttarakhand": 1030.34,
"West Bengal": 28432.28
}
}

This would return a base 64 encoded image of the map. Like this:

{
"result": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABLAAAASwCAIAAABkQySYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAgAElEQVR4nOzdB1RTdxsG8IvK3htlqKCotShV68BRF+4Jbq0iilotahU3DtyzzqK4iwPrxokiKsuBqEwZgggCskcSsm/udyB+acRRB+Em5Pmd5/TUSxJe..."
}

You can then use this image in your application. For example, you can display it in an <img> tag like this:

<img src="{resp.result}" alt="Map" />

This would display the map like this:

Map of India

  • mapName should be one of the valid map names listed below:
Click to see the list of valid mapNames
  • andhranew
  • africa
  • andhrapradesh
  • arunachalpradesh
  • asia
  • assam
  • bangladesh
  • bangladesh_dist_m
  • bengalx
  • bharat
  • bhutan
  • bihar
  • chhattisgarh
  • china
  • constituencies_m
  • delhi
  • europe
  • goa
  • gujarat
  • haryana
  • himachalpradesh
  • india
  • indiadist_m
  • jammukashmir
  • jharkhand
  • karnataka
  • kerala
  • madhyapradesh
  • maharashtra
  • manipur
  • meghalaya
  • mizoram
  • nagaland
  • nepal
  • nepal_dist_m
  • nepal_old
  • north-america
  • oceania
  • odisha
  • pakistan
  • punjab
  • rajasthan
  • sikkim
  • south-america
  • south-asia
  • sri_lanka
  • tamilnadu
  • telangana
  • tripura
  • usa
  • uttarakhand
  • uttarpradesh
  • westbengal
  • westeros
  • world
  • worldflat

Map customization

  • size | number (optional): Size of the map. If not specified, the default size is 1200.

  • lang | string (optional): The language in which to display region names. If not specified, the default language is English.

  • focus | string[] (optional): An array of regions to focus on. This field is only applicable for maps with names ending in _m. For example, if you want to focus on the states of Maharashtra and Gujarat in the indiadist_m map, you can specify the focus field like this:

{
"focus": ["Maharashtra", "Gujarat"]
}
  • palette | string or object (optional): The color palette to use for the map. If not specified, the default palette is Ladakh. The following palettes are supported:

Palettes

You can also specify your own custom palette. For example, this is the palette used for Ladakh:

[
{
"pos": 0,
"color": "#e8fdff"
},
{
"pos": 0.315,
"color": "#6fe7f2"
},
{
"pos": 0.652,
"color": "#24a5ff"
},
{
"pos": 1,
"color": "#00327b"
}
]
  • bgcolor | string (optional): The background color of the map. It can either be hex or rgb. If not specified, the default background color is #ffffff.

Metadata

IIPMaps API supports a wide range of regions and languages. You can retrieve the full list of supported regions and languages by making a GET request to {{baseurl}}/api/metadata?mapName=india.

The response looks like this:

{
"regions": [
{
"name": "Madhya Pradesh"
},
{
"name": "Delhi"
},
{
"name": "Uttarakhand"
},
{
"name": "Himachal Pradesh"
},
{
"name": "Ladakh"
},
{
"name": "Jammu and Kashmir"
},
{
"name": "DNHDD"
},
{
"name": "Chandigarh"
},
{
"name": "Puducherry"
},
{
"name": "Tamil Nadu"
},
{
"name": "Andaman and Nicobar Islands"
},
{
"name": "Mizoram"
},
{
"name": "Manipur"
},
{
"name": "Nagaland"
},
{
"name": "Arunachal Pradesh"
},
{
"name": "Sikkim"
},
{
"name": "Bihar"
},
{
"name": "Uttar Pradesh"
},
{
"name": "Haryana"
},
{
"name": "Andhra Pradesh"
},
{
"name": "Karnataka"
},
{
"name": "Goa"
},
{
"name": "West Bengal"
},
{
"name": "Jharkhand"
},
{
"name": "Chhattisgarh"
},
{
"name": "Kerala"
},
{
"name": "Tripura"
},
{
"name": "Meghalaya"
},
{
"name": "Assam"
},
{
"name": "Punjab"
},
{
"name": "Gujarat"
},
{
"name": "Maharashtra"
},
{
"name": "Odisha"
},
{
"name": "Rajasthan"
},
{
"name": "Telangana"
},
{
"name": "Lakshadweep"
}
],
"langs": [
"English",
"Hindi",
"Odia",
"Kannada",
"Malayalam",
"Tamil",
"Bengali",
"Punjabi",
"Gujarati",
"Telugu",
"Urdu",
"Axomiya"
]
}

The regions array in the response contains all the regions that can be displayed on the map, while the langs array contains all the supported languages.