GeoJSON (.geojson)

Background & Context

    • MIME type: application/geo+json.
    • GeoJSON GIS format.
    • Geospatial data interchange format based on JavaScript Object Notation (JSON).
    • Open standard format for representing simple geographical features.
    • GeoJSON identifies GeoJSON objects with list of rules in the Wolfram Language.
    • GeoJSON is specified by RFC 7946.


  • Import["file.geojson"] imports a GeoJSON file and renders it as a GeoGraphics object.
  • Import["file.geojson","elem"] imports the specified element from a GeoJSON file.
  • Import["file.geojson",{{"elem1","elem2",}}] imports multiple elements.
  • Export["file.geojson",expr] exports a GeoGraphics or DynamicGeoGraphics expression to a GeoJSON file.
  • Coordinate numbers where scientific notation is used are given in JSON in E notation.
  • The symbols True and False are represented in JSON as the values true and false.
  • The GeoJSON format does not store geo projection information.

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties and settings
  • Data representation elements:
  • "Data"rule-based representation for each feature of the GeoJSON archive
    "Graphics"all geometric features combined into a single GeoGraphics object
    "GraphicsList"list of graphics representing the geometric features of a GeoJSON archive
  • Import by default uses the "Graphics" element for the GeoJSON format.
  • Spatial information elements:
  • "CoordinateSystem"name of the coordinate reference system
    "SpatialRange"range of geographic coordinates, typically given in decimal degrees
  • Low-level meta-information from the file:
  • "CoordinateSystemInformation"raw parameters of the coordinate reference system


  • Export options:
  • "Compact"Falsewhether to omit line breaks and tabs


open allclose all

Basic Examples  (3)

Import the contents of a GeoJSON file:

Export a GeoGraphics object as a GeoJSON file:

Import the GeoJSON file:

Print the GeoJSON code:

Read a GeoJSON file as a string:

Import the string and interpret it as a GeoGraphics object:

Scope  (6)

Export a GeoGraphics map as a GeoJSON file:

Import the file:

Export a GeoGraphics object as a string using the GeoJSON format:

Specify explicitly the GeoJSON format to export a GeoGraphics object to a JSON file:

Import the file as pure JSON:

Import the file as GeoJSON:

Export a GeoGraphics expression containing graphical directives, encoded as GeoJSON properties:

Import back the GeoGraphics data:

Import a particular element from a GeoJSON file:

Export GeoGraphics primitives and directives of different types:

Import the file:

Give the list of possible elements to import from a GeoJSON file:

Import one element:

Import several elements:

Import Elements  (4)

"Data"  (1)

The "Data" element returns the data in the GeoJSON file, interpreted as Wolfram Language expressions:

"Graphics"  (1)

Import the GeoGraphics version of a GeoJSON file:

"GraphicsList"  (1)

Import a GeoJSON file as a complete GeoGraphics object:

Import a list of GeoGraphics objects for the respective geo primitives:

"SpatialRange"  (1)

Get the spatial range used in a GeoJSON file:

Compare to the GeoJSON specification of that geo range:

That GeoJSON file contains only bounding box information, which is used when importing to GeoGraphics:

Export Options  (1)

"Compact"  (1)

Return a compact form of the code by limiting indentation:

Applications  (1)

Download earthquake data for the East Coast of the US:

Export a GeoGraphics map of the data as a GeoJSON file, so that it can be used in other applications:

Verify the result, importing the "Data" element of the GeoJSON file:

Import the GeoJSON file using a relief geo background, to show correlation with the topography:

Introduced in 2017