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
- 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.
- See the following reference pages for full general information:
-
Import, Export import from or export to a file CloudImport, CloudExport import from or export to a cloud object ImportString, ExportString import from or export to a string ImportByteArray, ExportByteArray import from or export to a byte array
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
Examples
open allclose allBasic Examples (3)
Import the contents of a GeoJSON file:
Export a GeoGraphics object as a GeoJSON file:
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:
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:
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:
Give the list of possible elements to import from a GeoJSON file:
Import Elements (4)
"Data" (1)
"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:
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: