Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
podcast
Filter by Categories
ArcGIS Pro
GDAL
GeoJson
Map
Python
QGIS
Uncategorized

What is GeoJson

What is GeoJson and why you should care?

We can’t talk about GeoJson without first understanding JSON

GeoJSON and JSON are both data interchange formats used for storing and exchanging data. While JSON (JavaScript Object Notation) is a text-based format that is used universally across various programming environments for encoding structured data, GeoJSON is a specific implementation of JSON that focuses on encoding geographical data structures. Here’s a more detailed comparison:

JSON

  • General Use: JSON is a lightweight data interchange format that is easy for humans to read and write, and easy for machines to parse and generate. It is derived from JavaScript but is language-independent, with many programming languages including code to generate and parse JSON-format data.
  • Structure: JSON data is organized into key/value pairs and ordered lists. Its basic structures are objects (an unordered collection of key/value pairs) and arrays (an ordered list of values).
  • Versatility: JSON is highly versatile and can represent simple data structures like strings and numbers, as well as complex nested objects and arrays. This makes JSON suitable for a wide range of applications beyond web development, including configuration files, data exchange between servers, and much more.
  • Syntax: Simple and minimal. For example, it uses curly braces for objects, square brackets for arrays, and key-value pairs are separated by colons.

GeoJSON

  • Specific Use: GeoJSON is a format for encoding a variety of geographic data structures using JSON. It extends JSON by adding specific types and properties necessary to represent geographical features, geometries, and properties of spatial data.
  • Structure: GeoJSON introduces specific types such as “Feature”, “FeatureCollection”, and geometries like “Point”, “LineString”, “Polygon”, “MultiPoint”, “MultiLineString”, and “MultiPolygon”. Each “Feature” in GeoJSON contains a “geometry” object and a “properties” object for storing metadata.
  • Geographical Data Representation: GeoJSON is specifically designed to represent geographical features and their attributes effectively. This includes the ability to encode spatial information like coordinates, lines, and polygons, making it especially useful in GIS (Geographic Information Systems), web mapping applications, and spatial data analysis.
  • Syntax: Inherits JSON’s syntax but adds specific structures for representing spatial data. For example, a “Feature” object must contain a “type” property (which must be “Feature”), a “geometry” property specifying the feature’s shape, and a “properties” object for additional metadata.

Comparison and Contrast

  • Scope: JSON is general-purpose and can represent any data structure, while GeoJSON is specialized for geographical data.
  • Data Types: JSON focuses on generic data types like objects, arrays, strings, and numbers. GeoJSON introduces specific types related to geography, such as “Feature” and “Geometry” objects.
  • Usage Context: JSON is used broadly across many types of applications for data interchange. GeoJSON, however, is primarily used in mapping, GIS platforms, and applications that require spatial data processing.
  • Flexibility vs. Specificity: JSON provides the flexibility to model data for a wide range of applications. GeoJSON provides a structured and standardized way to represent spatial data, which is crucial for interoperability in geographic information processing.

Here’s a table that compares JSON and GeoJSON formats

AspectJSONGeoJSON
Use CaseGeneral data interchange format for encoding structured data. Can be used in a wide variety of applications, from web applications to configuration files.Encoding geographical data structures, specifically for geographic information system (GIS) applications, web mapping, and spatial data manipulation.
Data TypesSupports basic data types such as strings, numbers, arrays, and objects.Extends JSON to include geographical data types, such as Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, and GeometryCollection.
StructureOrganized in key/value pairs (objects) and ordered lists (arrays). Can represent complex nested structures.Introduces specific types like Feature and FeatureCollection, along with geometrical structures. Each Feature can contain a geometry object, a type, and a properties object for metadata.
ExamplesSimple object: json { "name": "John Doe", "age": 30, "isStudent": false }Point Example: json { "type": "Point", "coordinates": [102.0, 0.5] } Feature Example: json { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0] ] ] }, "properties": { "name": "A sample polygon" } }
FlexibilityHighly flexible, capable of modeling a vast range of data structures beyond spatial data.While also flexible within its domain, GeoJSON is specialized for modeling geographical features and spatial data structures.
InteroperabilityWidely used and supported across many programming languages and platforms, facilitating broad interoperability for general data exchange.Highly interoperable within GIS and web mapping applications, ensuring standardized representation and exchange of spatial data.
Main PurposeTo serve as a lightweight, text-based interchange format that is easy for humans to read and write, and easy for machines to parse and generate.To standardize the encoding of geographic data structures in JSON format, facilitating the exchange and manipulation of GIS data across different systems and platforms.
Specialized StructuresNone specifically; JSON is designed to be general-purpose.GeoJSON introduces specific structures for spatial data, such as geometry, properties (for metadata), and type (to define the GeoJSON object type like Feature or FeatureCollection).
This comparison highlights the general purpose nature of JSON against the specialized, geospatial focus of GeoJSON, showcasing their respective use cases, structures, and examples.

GeoJSON supports various types of geometries

Here are examples of the most common geometries in GeoJSON:

Point

Represents a single geographic position. It is defined by a pair of coordinates (longitude and latitude).

{
  "type": "Point",
  "coordinates": [-105.01621, 39.57422] // Longitude, Latitude
}

LineString

Represents a series of points that form a line. Useful for mapping routes or any linear feature.

{
  "type": "LineString",
  "coordinates": [
    [-105.01621, 39.57422], // Start point
    [-105.01621, 39.77422], // End point
    // Additional points can be added to form a polyline
  ]
}

Polygon

Defines an area enclosed by a closed line (where the first and last coordinates are the same). Useful for representing boundaries, zones, or any area-based feature.

{
  "type": "Polygon",
  "coordinates": [
    [ // Outer boundary
      [-105.01621, 39.57422], // First corner
      [-105.01621, 39.77422], // Second corner
      [-104.01621, 39.77422], // Third corner
      [-104.01621, 39.57422], // Fourth corner
      [-105.01621, 39.57422] // Closing the loop to the first corner
    ]
  ]
}

MultiPoint

A collection of points. Suitable for representing multiple locations with a single GeoJSON object.

{
  "type": "MultiPoint",
  "coordinates": [
    [-105.01621, 39.57422],
    [-105.01621, 39.77422],
    // Additional points
  ]
}

MultiLineString

A set of LineStrings grouped together. This is useful for representing multiple routes or paths.

{
  "type": "MultiLineString",
  "coordinates": [
    [ // First LineString
      [-105.01621, 39.57422],
      [-105.01621, 39.77422]
    ],
    [ // Second LineString
      [-104.01621, 39.57422],
      [-104.01621, 39.77422]
    ]
    // Additional LineStrings
  ]
}

MultiPolygon

Represents multiple polygons. This can be used for complex area representations that consist of several distinct polygons.

{
  "type": "MultiPolygon",
  "coordinates": [
    [ // First polygon
      [ // Outer boundary
        [-105.01621, 39.57422],
        [-105.01621, 39.77422],
        [-104.01621, 39.77422],
        [-104.01621, 39.57422],
        [-105.01621, 39.57422]
      ]
    ],
    [ // Second polygon
      [ // Outer boundary
        [-106.01621, 39.57422],
        [-106.01621, 39.77422],
        [-107.01621, 39.77422],
        [-107.01621, 39.57422],
        [-106.01621, 39.57422]
      ]
    ]
    // Additional polygons
  ]
}

GeometryCollection

A collection of mixed geometry types within a single GeoJSON object. This allows for complex representations involving various types of geometries.

{
  "type": "GeometryCollection",
  "geometries": [
    {
      "type": "Point",
      "coordinates": [-105.01621, 39.57422]
    },
    {
      "type": "LineString",
      "coordinates": [
        [-105.01621, 39.57422],
        [-105.01621, 39.77422]
      ]
    }
    // Additional geometries
  ]
}

These examples showcase the versatility of GeoJSON in representing geographical data in various forms, from simple points to complex collections of shapes.

Want to convert Geojson to other formats? check out these articles!

Why you should care

Caring about GeoJSON can be important for several reasons, especially if your work or interests involve geographic information systems (GIS), web mapping, spatial data analysis, or any application that benefits from the representation and manipulation of geographical data. Here’s why GeoJSON holds significant value:

Simplified Data Sharing and Interoperability

GeoJSON is a text-based format, making it easy to read, write, and share across different systems and platforms. Its standardized structure promotes interoperability between various GIS software and web applications, facilitating the seamless exchange of spatial data.

Web and Mobile Mapping

If you’re involved in developing web or mobile applications that incorporate maps or spatial data, GeoJSON is particularly useful. It integrates smoothly with popular mapping libraries (such as Leaflet, OpenLayers, and the Google Maps API), enabling developers to quickly add and manipulate geographic data in their applications.

Accessibility and Human-Readable Format

GeoJSON’s JSON-based format is both human-readable and machine-parseable, which is advantageous for debugging, data inspection, and manual editing. This accessibility makes it easier to understand and manipulate spatial data without the need for specialized software.

Efficiency and Performance

For web-based applications, GeoJSON’s lightweight format can lead to faster loading times and improved performance, essential for delivering a smooth user experience. Its simplicity also reduces the complexity of developing and maintaining spatial data-driven applications.

Versatility in Spatial Data Representation

GeoJSON supports a wide range of geometries, including points, lines, polygons, and multi-part collections of these types. This versatility allows for the representation of a broad spectrum of spatial data, from simple locations to complex geometrical shapes.

Open Standard and Wide Adoption

As an open standard, GeoJSON has been widely adopted and supported by a vast ecosystem of tools and libraries. This widespread support ensures that resources, community knowledge, and tooling are readily available, reducing the barrier to entry for working with spatial data.

Facilitates Data Visualization and Analysis

GeoJSON’s structure is conducive to spatial data analysis and visualization, making it a preferred choice for projects requiring geographic data visualization, environmental analysis, urban planning, and more.

Enhances Collaboration across Disciplines

The accessibility and ease of use of GeoJSON foster collaboration between developers, GIS professionals, researchers, and decision-makers. By enabling the easy sharing of geographical data, it supports interdisciplinary projects and discussions focused on spatial analysis.

About the Author
I'm Daniel O'Donohue, the voice and creator behind The MapScaping Podcast ( A podcast for the geospatial community ). With a professional background as a geospatial specialist, I've spent years harnessing the power of spatial to unravel the complexities of our world, one layer at a time.