← API Reference

Examples

D3.js maps built with the mapjson API

countries · world · areakm2 · choropleth · Equal Earth
Country Area
World countries colored by land area using the opt-in areakm2 property. Log scale handles Russia-to-Monaco range. Demonstrates using areakm2 as a denominator for density calculations.
countries · low detail · properties · hover · zoom
World Countries
The mapjson.com homepage map — Equal Earth projection with dark ocean, graticule, hover tooltips, and zoom + pan. Uses properties=name to attach country names.
countries · low detail
Simple World
The minimal mapjson call — no parameters needed. Returns 110m world countries as geometry-only topojson. The fastest starting point for any world map.
countries · medium detail · filter · properties
Europe with Hover
Filtered to European countries at medium resolution with country names as properties. Hover to inspect each country.
postal · US-MA · ZCTA · zip codes
Massachusetts ZIP Areas
All 539 Massachusetts ZIP code areas from the new postal layer, colored by 3-digit prefix. Every feature's gid is the bare ZIP code — join your ZIP-keyed data with a dictionary lookup.
regions · medium detail · filter
USA States
US administrative regions using the regions layer filtered to a single country. AlbersUsa projection for clean continental rendering.
countries · disputed territories
Disputed Territories
World countries including disputed and partially-recognized territories — Kosovo, Western Sahara, Palestine, and others — highlighted separately.
countries · medium detail · filter · properties
Caribbean Islands
The Caribbean zoomed in at medium detail — each territory appears as its own polygon. Aruba, Martinique, Guadeloupe, Bonaire and others all hover correctly with their own ISO codes.
regions · high detail · filter · properties
Poland Voivodeships
Poland's 16 first-level administrative divisions at high detail. Uses fitSize to auto-fit the projection to the returned geometry — the same pattern works for any country.
countries · subregions · capitals · hover
Africa
Countries colored by subregion — Northern, Eastern, Western, Middle, and Southern Africa. Capital cities plotted from capitalLat and capitalLng properties. Labels use a force simulation to avoid overlapping.
countries · high detail · iso filter
Aruba
Aruba is 180 km² — invisible at standard resolutions. When filter is an ISO country code and detail=high, the API automatically serves a high-resolution file for small countries and territories.
countries · high detail · country name filter · geojson
Martinique
A French Caribbean territory filtered by full country name — filter=Martinique is resolved to ISO code MQ server-side. At detail=high the 10m dataset resolves the island clearly.
districts · region filter · topojson · choropleth
Massachusetts Counties
14 counties fetched with filter=US-MA — only this state's districts, not all 3224 US counties. Population choropleth joined via 5-digit FIPS gid — the same code used by Census, BLS, and CDC data.
countries · orthographic · graticule · interactive
Globe
World countries on an orthographic (perspective) projection — the view from space. Land in sage green, ocean in slate blue, 30° graticule in white. Drag to rotate.
districts · choropleth · external data · cdc
US Counties — Depression Rates
Continental US counties colored by depression prevalence from the CDC PLACES 2023 dataset — joined to county geometry by FIPS code via a client-side Socrata API call. State borders drawn with topojson.mesh.
countries · rivers · lakes · multiple layers
Physical Features
Three API calls composed into one map — countries as the base layer, overlaid with rivers and lakes. Shows how to build up a richer world map from independent layers.