Geographic map data as a single API call
mapjson returns topojson (or geojson) for any geographic layer in a single AJAX call. The shortest possible call returns 110m world countries with no attached properties — the most common use case for a world map.
// Minimal call — 110m world countries, no properties
d3.json("https://api.mapjson.com/v1/geo").then(topo => {
const countries = topojson.feature(topo, topo.objects.geo);
// draw your map
});
// With filtering and properties
d3.json("https://api.mapjson.com/v1/geo?layer=countries&filter=europe&detail=medium&properties=name,iso2")
.then(topo => { /* ... */ });
| Parameter | Default | Options | Description |
|---|---|---|---|
layer |
countries |
Which geographic layer to return. All layers return polygon or line geometry. See Layers below. | |
filter |
world |
Filters output to a continent or a specific country (ISO alpha-2 code, e.g. FR). Use {ISO2} with layer=regions to get the administrative regions of one country. |
|
detail |
low |
Geometry resolution. See Detail Levels below. | |
properties |
none |
name, nameOfficial, iso2, iso3, isoNum, continent, subregion, capital, capitalLat, capitalLng |
Comma-separated list of properties to attach to each feature. Omit entirely for geometry-only output (smallest response). Only applies to countries and regions layers. |
format |
topojson |
Output format. Topojson is smaller and faster to render. Geojson is more compatible with other tools. |
disputed: true property. Supports filter, detail, properties.filter=US to get one country's regions.detail.detail.detail.| Value | Source resolution | Best for | Typical file size |
|---|---|---|---|
low |
110m (Natural Earth) | World maps, small insets, thumbnails | ~100 KB |
medium |
50m (Natural Earth) | Continent-level maps | ~300 KB |
high |
10m (Natural Earth) | Country and regional maps | ~2 MB |
ultra |
OSM / GADM | Small countries (Andorra, Monaco, Singapore) | varies |
ultra is not yet available — currently falls back to high.
Available on countries and regions layers. No properties are returned by default — pass ?properties=name,iso2 to request specific fields. This keeps the default response as small as possible.
https://api.mapjson.com/v1/geo
https://api.mapjson.com/v1/geo?layer=countries&filter=europe&detail=medium&properties=name,iso2
https://api.mapjson.com/v1/geo?layer=regions&filter=FR&detail=high
https://api.mapjson.com/v1/geo?layer=regions&filter=US&detail=medium
https://api.mapjson.com/v1/geo?layer=regions&filter=PL&detail=high
https://api.mapjson.com/v1/geo?layer=lakes&detail=medium&format=geojson
The default response is a topojson Topology object. The feature collection is always at topo.objects.geo regardless of which layer you requested. All responses include Access-Control-Allow-Origin: *.
{
"type": "Topology",
"objects": {
"geo": {
"type": "GeometryCollection",
"geometries": [
{
"type": "Polygon",
"arcs": [[0, 1, 2]],
"properties": {
"name": "France",
"iso2": "FR",
"iso3": "FRA",
"isoNum": "250",
"continent": "Europe",
"capital": "Paris",
"capitalLat": 48.8566,
"capitalLng": 2.3515
}
}
// ...
]
}
},
"arcs": [ ... ],
"bbox": [-180, -90, 180, 90]
}
When no properties parameter is given, each feature's properties object is empty ({}).
Use these ISO alpha-2 codes with the filter parameter (e.g. filter=DE) to retrieve a specific country.
* Informal code — not officially assigned by ISO 3166-1.
| ISO2 | ISO3 | Name |
|---|---|---|
| AF | AFG | Afghanistan |
| AX | ALA | Åland |
| AL | ALB | Albania |
| DZ | DZA | Algeria |
| AS | ASM | American Samoa |
| AD | AND | Andorra |
| AO | AGO | Angola |
| AI | AIA | Anguilla |
| AQ | ATA | Antarctica |
| AG | ATG | Antigua and Barb. |
| AR | ARG | Argentina |
| AM | ARM | Armenia |
| AW | ABW | Aruba |
| AT | AUT | Austria |
| AZ | AZE | Azerbaijan |
| BS | BHS | Bahamas |
| BH | BHR | Bahrain |
| BD | BGD | Bangladesh |
| BB | BRB | Barbados |
| BY | BLR | Belarus |
| BE | BEL | Belgium |
| BZ | BLZ | Belize |
| BJ | BEN | Benin |
| BM | BMU | Bermuda |
| BT | BTN | Bhutan |
| BO | BOL | Bolivia |
| BA | BIH | Bosnia and Herz. |
| BW | BWA | Botswana |
| IO | IOT | Br. Indian Ocean Ter. |
| BR | BRA | Brazil |
| VG | VGB | British Virgin Is. |
| BN | BRN | Brunei |
| BG | BGR | Bulgaria |
| BF | BFA | Burkina Faso |
| BI | BDI | Burundi |
| CV | CPV | Cabo Verde |
| KH | KHM | Cambodia |
| CM | CMR | Cameroon |
| CA | CAN | Canada |
| KY | CYM | Cayman Is. |
| CF | CAF | Central African Rep. |
| TD | TCD | Chad |
| CL | CHL | Chile |
| CN | CHN | China |
| CO | COL | Colombia |
| KM | COM | Comoros |
| CG | COG | Congo |
| CK | COK | Cook Is. |
| CR | CRI | Costa Rica |
| CI | CIV | Côte d'Ivoire |
| HR | HRV | Croatia |
| CU | CUB | Cuba |
| CW | CUW | Curaçao |
| CY | CYP | Cyprus |
| CZ | CZE | Czechia |
| CD | COD | Dem. Rep. Congo |
| DK | DNK | Denmark |
| DJ | DJI | Djibouti |
| DM | DMA | Dominica |
| DO | DOM | Dominican Rep. |
| EC | ECU | Ecuador |
| EG | EGY | Egypt |
| SV | SLV | El Salvador |
| GQ | GNQ | Eq. Guinea |
| ER | ERI | Eritrea |
| EE | EST | Estonia |
| SZ | SWZ | eSwatini |
| ET | ETH | Ethiopia |
| FO | FRO | Faeroe Is. |
| FK | FLK | Falkland Is. |
| FJ | FJI | Fiji |
| FI | FIN | Finland |
| PF | PYF | Fr. Polynesia |
| TF | ATF | Fr. S. Antarctic Lands |
| GA | GAB | Gabon |
| GM | GMB | Gambia |
| GE | GEO | Georgia |
| DE | DEU | Germany |
| GH | GHA | Ghana |
| GI | GIB | Gibraltar |
| GR | GRC | Greece |
| GL | GRL | Greenland |
| GD | GRD | Grenada |
| GU | GUM | Guam |
| GT | GTM | Guatemala |
| GG | GGY | Guernsey |
| GN | GIN | Guinea |
| GW | GNB | Guinea-Bissau |
| GY | GUY | Guyana |
| HT | HTI | Haiti |
| HM | HMD | Heard I. and McDonald Is. |
| HN | HND | Honduras |
| HK | HKG | Hong Kong |
| HU | HUN | Hungary |
| IS | ISL | Iceland |
| IN | IND | India |
| ID | IDN | Indonesia |
| IR | IRN | Iran |
| IQ | IRQ | Iraq |
| IE | IRL | Ireland |
| IM | IMN | Isle of Man |
| IL | ISR | Israel |
| IT | ITA | Italy |
| JM | JAM | Jamaica |
| JP | JPN | Japan |
| JE | JEY | Jersey |
| JO | JOR | Jordan |
| KZ | KAZ | Kazakhstan |
| KE | KEN | Kenya |
| KI | KIR | Kiribati |
| XK | XKX | Kosovo * |
| KW | KWT | Kuwait |
| KG | KGZ | Kyrgyzstan |
| LA | LAO | Laos |
| LV | LVA | Latvia |
| LB | LBN | Lebanon |
| LS | LSO | Lesotho |
| LR | LBR | Liberia |
| LY | LBY | Libya |
| LI | LIE | Liechtenstein |
| LT | LTU | Lithuania |
| LU | LUX | Luxembourg |
| MO | MAC | Macao |
| MG | MDG | Madagascar |
| MW | MWI | Malawi |
| MY | MYS | Malaysia |
| MV | MDV | Maldives |
| ML | MLI | Mali |
| MT | MLT | Malta |
| MH | MHL | Marshall Is. |
| MR | MRT | Mauritania |
| MU | MUS | Mauritius |
| MX | MEX | Mexico |
| FM | FSM | Micronesia |
| MD | MDA | Moldova |
| MC | MCO | Monaco |
| MN | MNG | Mongolia |
| ME | MNE | Montenegro |
| MS | MSR | Montserrat |
| MA | MAR | Morocco |
| MZ | MOZ | Mozambique |
| MM | MMR | Myanmar |
| MP | MNP | N. Mariana Is. |
| NA | NAM | Namibia |
| NR | NRU | Nauru |
| NP | NPL | Nepal |
| NL | NLD | Netherlands |
| NC | NCL | New Caledonia |
| NZ | NZL | New Zealand |
| NI | NIC | Nicaragua |
| NE | NER | Niger |
| NG | NGA | Nigeria |
| NU | NIU | Niue |
| NF | NFK | Norfolk Island |
| KP | PRK | North Korea |
| MK | MKD | North Macedonia |
| OM | OMN | Oman |
| PK | PAK | Pakistan |
| PW | PLW | Palau |
| PS | PSE | Palestine |
| PA | PAN | Panama |
| PG | PNG | Papua New Guinea |
| PY | PRY | Paraguay |
| PE | PER | Peru |
| PH | PHL | Philippines |
| PN | PCN | Pitcairn Is. |
| PL | POL | Poland |
| PT | PRT | Portugal |
| PR | PRI | Puerto Rico |
| QA | QAT | Qatar |
| RO | ROU | Romania |
| RU | RUS | Russia |
| RW | RWA | Rwanda |
| GS | SGS | S. Geo. and the Is. |
| SS | SSD | S. Sudan |
| SH | SHN | Saint Helena |
| LC | LCA | Saint Lucia |
| WS | WSM | Samoa |
| SM | SMR | San Marino |
| ST | STP | São Tomé and Principe |
| SA | SAU | Saudi Arabia |
| SN | SEN | Senegal |
| RS | SRB | Serbia |
| SC | SYC | Seychelles |
| SL | SLE | Sierra Leone |
| SG | SGP | Singapore |
| SX | SXM | Sint Maarten |
| SK | SVK | Slovakia |
| SI | SVN | Slovenia |
| SB | SLB | Solomon Is. |
| SO | SOM | Somalia |
| ZA | ZAF | South Africa |
| KR | KOR | South Korea |
| ES | ESP | Spain |
| LK | LKA | Sri Lanka |
| BL | BLM | St-Barthélemy |
| MF | MAF | St-Martin |
| KN | KNA | St. Kitts and Nevis |
| PM | SPM | St. Pierre and Miquelon |
| VC | VCT | St. Vin. and Gren. |
| SD | SDN | Sudan |
| SR | SUR | Suriname |
| SE | SWE | Sweden |
| CH | CHE | Switzerland |
| SY | SYR | Syria |
| CN-TW | TWN | Taiwan |
| TJ | TJK | Tajikistan |
| TZ | TZA | Tanzania |
| TH | THA | Thailand |
| TL | TLS | Timor-Leste |
| TG | TGO | Togo |
| TO | TON | Tonga |
| TT | TTO | Trinidad and Tobago |
| TN | TUN | Tunisia |
| TR | TUR | Turkey |
| TM | TKM | Turkmenistan |
| TC | TCA | Turks and Caicos Is. |
| TV | TUV | Tuvalu |
| UM | UMI | U.S. Minor Outlying Is. |
| VI | VIR | U.S. Virgin Is. |
| UG | UGA | Uganda |
| UA | UKR | Ukraine |
| AE | ARE | United Arab Emirates |
| GB | GBR | United Kingdom |
| US | USA | United States of America |
| UY | URY | Uruguay |
| UZ | UZB | Uzbekistan |
| VU | VUT | Vanuatu |
| VA | VAT | Vatican |
| VE | VEN | Venezuela |
| VN | VNM | Vietnam |
| EH | ESH | W. Sahara |
| WF | WLF | Wallis and Futuna Is. |
| YE | YEM | Yemen |
| ZM | ZMB | Zambia |
| ZW | ZWE | Zimbabwe |