Skip to main content

Understand GeoJSON Coordinate Precision

GeoJSON is a popular format for encoding geographic data structures. A critical aspect of GeoJSON is the coordinate precision used in storing vector data, which directly impacts file size, rendering performance, and location accuracy.

Recommended GeoJSON Coordinate Precision

The recommended coordinate precision for GeoJSON is 6 decimal places, which provides a good balance between accuracy and file size. This level of precision allows for accurate representation of features while keeping the file size manageable.

What is coordinate precision in GeoJSON?

In GeoJSON, geographic coordinates are typically expressed as floating-point numbers in decimal degrees, describing locations on earth using the WGS84 datum. Precision refers to how many decimal places are used to represent latitude and longitude values.

The example below illustrates a GeoJSON Point feature with high coordinate precision, using 9 digits after the decimal point:

point-high-precision.geojson
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [102.123456789, 0.987654321]
},
"properties": {}
}

A Point feature with lower coordinate precision might look like this, using only 3 digits after the decimal point:

point-low-precision.geojson
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [102.031, 0.592]
},
"properties": {}
}

Why coordinate precision matters

High coordinate precision can lead to larger file sizes and slower rendering times, especially when dealing with large datasets. Each additional decimal place increases the number of digits stored, which can significantly inflate the size of GeoJSON files.

Conversely, lower precision reduces file size and improves performance but may sacrifice location accuracy. The trade-off between precision and performance is crucial, especially for applications that require real-time rendering or have bandwidth constraints.

Decimal PlacesApproximate Accuracy
1~10 km
2~1 km
3~100 m
4~10 m
5~1 m
6~10 cm
7~1 cm

Visualizing coordinate precision

This interactive map shows a grid of points representing single-digit increments of various coordinate precisions.

Choose a different precision level to see how it affects the coverage area of the grid of points. As the coordinate precision increases, you can see that each point represents a smaller area of the earth, demonstrating the impact of coordinate precision on geographic data representation. You can hover over each point to see its coordinates.

Reducing coordinate precision in GeoJSON

If you are processing data programmatically, you can iterate over the coordinates in your GeoJSON features and round them to a specified number of decimal places. For example, using Python, you can use the round() function to reduce precision:

import json
from geojson import Point, Feature, FeatureCollection
def reduce_precision(coordinates, precision=6):
return [round(coord, precision) for coord in coordinates]

There are also libraries and tools available specifically for use with GeoJSON that can help reduce coordinate precision. See the Additional resources section below for more information.

Exporting or converting GeoJSON with software may generate high coordinate precision and large file sizes. For example, exporting a vector layer in QGIS to GeoJSON will produce coordinates with 15 decimal places by default if you do not specify a lower coordinate precision. 15 decimal places is unnecessary for most applications and should be reduced to improve performance and file size.

Additional resources

  • GeoJSON Specification - Read the official GeoJSON specification for details on coordinate precision and other aspects of the format.
  • Observable Notebook on Coordinate Precision - Volodymyr Agafonkin explains how latitude and longitude precision affects geographic data representation.
  • geojson-precision - A Python library for reducing coordinate precision in GeoJSON files.
  • turf/truncate - A Turf.js function that reduces the precision of coordinates in GeoJSON features.
Was this page helpful?