All converters
HomeBlog › GeoJSON explained: the format that runs the web map

GeoJSON explained: the format that runs the web map

By Ghulam Hasnain · PhD researcher, Space Science & Technology · · Updated · 2 min read

The GeoJSON format runs the modern web map. So if you touch web mapping, you will meet it. This guide explains what the GeoJSON format is, and how to create and convert it.

Advertisement

What the GeoJSON format is

GeoJSON is an open standard for map data. It is written in JSON, so it is plain text. As a result, JavaScript reads it natively. That is why the GeoJSON format is the default of web mapping.

The GeoJSON format: JSON features rendered on a web map in Leaflet or Mapbox
The GeoJSON format is the plain-text language of modern web maps.

Why the web loves it

Web tools speak JSON already. So GeoJSON drops straight into code. Also, it is human-readable, so you can inspect it by eye. Therefore it fits version control too.

How the GeoJSON format works

The structure is simple. A file holds features. Each feature has a geometry and some properties. So the geometry is the shape, and the properties are the data. For example, a point plus its name.

Geometry types

GeoJSON supports several shapes. For instance, Point, LineString and Polygon. It also has multi versions of each. So one file can mix many shapes.

The coordinate rule

The standard, RFC 7946, uses WGS84 longitude and latitude. Also, coordinates are written longitude first. So the order is the reverse of how people say it.

Where you use the GeoJSON format

Web maps are the main home. For example, Leaflet, Mapbox GL and OpenLayers all read it. So you pass features straight to the map. Also, many APIs return GeoJSON.

Strengths and limits

It is simple and universal. However, it is text, so large files get big. For huge datasets, a binary format is faster. So GeoJSON suits small to medium layers best.

Create and convert the GeoJSON format

You can make GeoJSON from what you have. For example, KML to GeoJSON, Shapefile to GeoJSON, or CSV to GeoJSON. Each runs in your browser, so nothing is uploaded. You can read the spec at geojson.org. In short, the GeoJSON format is the easiest way to put data on a web map.

Frequently asked questions

What is the GeoJSON format?

GeoJSON is an open standard for encoding map data in JSON. It stores features, each with a geometry and properties, as plain readable text. It is the default vector format of web maps and APIs.

Why do web maps use GeoJSON?

Web tools already speak JSON, so GeoJSON drops straight into JavaScript. Leaflet, Mapbox GL and OpenLayers read it natively, and it is human-readable, which makes it easy to inspect and version-control.

What coordinate system does GeoJSON use?

The RFC 7946 standard defines GeoJSON in WGS84 longitude and latitude, written longitude first. Some older tools assumed other systems, so set the CRS explicitly if a tool expects something else.

How do I create a GeoJSON file?

Convert data you already have. A browser-based converter turns KML, a shapefile or a CSV into GeoJSON locally, so nothing is uploaded. You can also export GeoJSON from QGIS.

When should I not use GeoJSON?

GeoJSON is text, so very large datasets become heavy. For huge layers or streaming, a binary format like FlatGeobuf or a database is faster. GeoJSON suits small to medium layers best.

Related converters

Keep reading

About the author

Ghulam Hasnain is a PhD researcher in space science and technology who works with GIS and remote-sensing data every day, wrangling shapefiles, KML, GPX and CAD drawings across QGIS, ArcGIS and Google Earth. He built GISConverter after one too many format conversions that required uploading sensitive survey data to a stranger's server.

Advertisement