Learn

World countries GeoJSON: where to get it and how to use it

Several free GeoJSON datasets cover all world countries. The right one depends on your resolution needs and whether you're in a browser, Node.js, or a build pipeline.

Three reliable sources

geojson-maps.ash.ms

geojson-maps.ash.ms is a browser tool that lets you download world country boundaries at three resolution levels — 10m, 50m, and 110m — as a single GeoJSON file. No account required, no CLI, no npm. Click the resolution you want, download the file.

Properties included: NAME, ISO_A2, ISO_A3, CONTINENT, POP_EST. The data comes from Natural Earth, which is public domain.

country-json on GitHub

github.com/samayo/country-json is a collection of per-country JSON datasets, MIT licensed. It includes a country-by-geo-coordinates.json file with centroid coordinates and separate GeoJSON geometry files by country.

For Node.js use:

npm install country-json
const countries = require('country-json/src/country-by-geo-coordinates.json')

This is most useful when you need per-country data in a pipeline rather than a single FeatureCollection.

@geo-maps/countries-land

@geo-maps/countries-land is an npm package family that ships world country land polygons as a GeoJSON FeatureCollection, ready to import directly in JavaScript or TypeScript. Three resolution variants are available:

npm install @geo-maps/countries-land-10km   # ~4 MB
npm install @geo-maps/countries-land-1km    # ~23 MB
npm install @geo-maps/countries-land-110km  # ~800 KB
import countries from '@geo-maps/countries-land-10km'
// countries is a FeatureCollection — use it directly

This is the right choice when you're bundling country data into a JavaScript application and want typed imports with no fetch required.

Resolution tradeoffs

ResolutionApprox. file sizeBest for
10m~23 MBHigh-detail zoom (country detail maps)
50m~4 MBGeneral world maps
110m~800 KBThumbnails, performance-critical apps

At 110m, small island nations lose detail or disappear entirely. At 10m, you get accurate coastlines but the file size makes it unsuitable for bundling into a browser app without a CDN or tile server.

For most web mapping use cases — a choropleth, a region selector, a country outline layer — 50m is the right balance.

Property names

Each source uses different keys. Check before writing filter code.

Propertygeojson-maps.ash.ms@geo-maps/countries-land
Country nameNAMEA3 (ISO only — no plain name field)
ISO 3166-1 alpha-2ISO_A2A2
ISO 3166-1 alpha-3ISO_A3A3

@geo-maps strips non-essential properties to keep file size small — if you need country names in properties, use geojson-maps.ash.ms or join with a lookup table.

When in doubt, inspect a feature directly:

console.log(countries.features[0].properties)
// { A2: 'AF', A3: 'AFG' }

Filter to one country

import countries from '@geo-maps/countries-land-10km'

const france = {
  type: 'FeatureCollection',
  features: countries.features.filter(
    f => f.properties.A2 === 'FR'
  ),
}

France includes overseas territories — Réunion, French Guiana, Martinique — because those are part of the sovereign territory encoded in ISO 3166-1. Its geometry is a MultiPolygon — disconnected land masses represented as one feature. If you want metropolitan France only, filter by bounding box after the ISO filter.

Simplify for performance

If you've downloaded a high-resolution dataset and need to reduce it for a specific zoom level, two tools handle this well.

mapshaper CLI (recommended for large datasets):

# Install once
npm install -g mapshaper

# Simplify to 10% of original vertex count
mapshaper input.geojson -simplify 10% -o output.geojson

mapshaper preserves topology by default — shared borders between countries stay aligned after simplification, so you don't get gaps or overlaps at country edges.

Turf.js (for in-process simplification in Node.js or the browser):

import { simplify } from '@turf/simplify'

const simplified = simplify(feature, { tolerance: 0.01, highQuality: false })

tolerance is in degrees (same units as WGS 84 coordinates). 0.01 degrees ≈ 1 km at the equator. For world-scale maps, 0.1–0.5 is usually enough.

Watch out: Antarctica appears in most world country datasets and is enormous in most projections — it dominates the southern half of any equirectangular or Mercator map. Filter it out by default: f.properties.NAME !== 'Antarctica'.


For copy-paste GeoJSON examples including a MultiPolygon country example, see GeoJSON examples. For using this data in Power BI, see GeoJSON in Power BI.

If you're building an interactive country map where users can select or edit regions, Element Editor is an open-source React library that adds editing on top of Leaflet or MapLibre.

Continue reading

Mike Acler

Mike Acler

Design engineer and creator of Element Editor, an open-source map drawing and GeoJSON editing library for React. Writes about web cartography and GIS tooling.