WOLFRAM

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

Import Elements

  • General Import elements:
  • "Elements" list of elements and options available in this file
    "Summary"summary of the file
    "Rules"list of rules for all available elements
  • 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 allclose all

Basic Examples  (3)Summary of the most common use cases

Import the contents of a GeoJSON file:

Out[1]=1

Export a GeoGraphics object as a GeoJSON file:

Out[1]=1
Out[2]=2

Import the GeoJSON file:

Out[3]=3

Print the GeoJSON code:

Read a GeoJSON file as a string:

Out[1]=1

Import the string and interpret it as a GeoGraphics object:

Out[2]=2

Scope  (6)Survey of the scope of standard use cases

Export a GeoGraphics map as a GeoJSON file:

Out[1]=1
Out[2]=2

Import the file:

Out[3]=3

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

Out[1]=1

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

Out[1]=1
Out[2]=2

Import the file as pure JSON:

Out[3]=3

Import the file as GeoJSON:

Out[4]=4

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

Out[1]=1
Out[2]=2

Import back the GeoGraphics data:

Out[3]=3

Import a particular element from a GeoJSON file:

Out[4]=4

Export GeoGraphics primitives and directives of different types:

Out[1]=1
Out[2]=2

Import the file:

Out[3]=3

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

Out[1]=1

Import one element:

Out[2]=2

Import several elements:

Out[3]=3

Import Elements  (4)

"Data"  (1)

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

Out[1]=1

"Graphics"  (1)

Import the GeoGraphics version of a GeoJSON file:

Out[1]=1

"GraphicsList"  (1)

Import a GeoJSON file as a complete GeoGraphics object:

Out[1]=1

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

Out[2]=2

"SpatialRange"  (1)

Get the spatial range used in a GeoJSON file:

Out[1]=1

Compare to the GeoJSON specification of that geo range:

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

Out[3]=3

Export Options  (1)

"Compact"  (1)

Return a compact form of the code by limiting indentation:

Out[1]=1

Applications  (1)Sample problems that can be solved with this function

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:

Out[2]=2
Out[3]=3

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

Out[4]=4

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

Out[5]=5