GeoJSON (.geojson)

Background

    • 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 & Export

  • 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

Options

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

Examples

open all close all

Basic Examples  (3)

Import the contents of a GeoJSON file:

In[1]:=
Click for copyable input
Out[1]=

Export a GeoGraphics object as a GeoJSON file:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Import the GeoJSON file:

In[3]:=
Click for copyable input
Out[3]=

Print the GeoJSON code:

In[4]:=
Click for copyable input

Read a GeoJSON file as a string:

In[1]:=
Click for copyable input
Out[1]=

Import the string and interpret it as a GeoGraphics object:

In[2]:=
Click for copyable input
Out[2]=

Scope  (6)

Import Elements  (4)

Export Options  (1)

Applications  (1)

Introduced in 2017
(11.2)