geoJSON
{{Short description|JSON subset for geospatial data}}
{{Use dmy dates|date=January 2024}}
{{Infobox file format
| name = GeoJSON
| logo =
| icon =
| iconcaption =
| screenshot =
| caption =
|_noextcode = on
| extensions = .json
, .geojson
|_nomimecode = on
| type code =
| uniform type =
| conforms to =
| magic =
| owner =
| released =
| latest release version =
| latest release date =
| genre = GIS file format
| container for =
| contained by =
| extended from = JSON
| extended to =
| standard = {{IETF RFC|7946}}
| open = yes
| url = {{URL|https://geojson.org}}
}}
GeoJSON{{cite IETF |title= |rfc=7946 |last1=Butler |first1=Howard |last2=Daly |first2=Martin |last3=Doyle |first3=Allan |last4=Gillies |first4=Sean |last5=Hagen |first5=Stefan |last6=Schaub |first6=Tim |date=August 2016 |publisher=IETF }} is an open standard format designed for representing simple geographical features, along with their non-spatial attributes. It is based on the JSON format.
The features include points (therefore addresses and locations), line strings (therefore streets, highways and boundaries), polygons (countries, provinces, tracts of land), and multi-part collections of these types. GeoJSON features are not limited to representing entities of the physical world only; mobile routing and navigation apps, for example, might describe their service coverage using GeoJSON.{{Cite web|url=https://developer.apple.com/library/archive/documentation/UserExperience/Conceptual/LocationAwarenessPG/ProvidingDirections/ProvidingDirections.html|title=Providing Directions|website=developer.apple.com}}
The GeoJSON format differs from other geographic information system standards in that it was written and is maintained not by a formal standards organization, but by an Internet working group of developers.{{Cite web|url=http://lists.geojson.org/listinfo.cgi/geojson-geojson.org|title=GeoJSON Info Page|website=lists.geojson.org}}
A notable offspring of GeoJSON is TopoJSON, an extension of GeoJSON that encodes geospatial topology and that typically provides smaller file sizes.
History
The GeoJSON format working group and discussion were begun in March 2007{{Cite web|url=http://lists.geojson.org/pipermail/geojson-geojson.org/2007-March/thread.html|title=The GeoJSON March 2007 Archive by thread|website=lists.geojson.org}} and the format specification was finalized in June 2008.
In April 2015 the Internet Engineering Task Force founded the Geographic JSON working group{{Cite web|url=https://datatracker.ietf.org/wg/geojson/history/|title=Geographic JSON (geojson) -|website=datatracker.ietf.org}} which released GeoJSON as RFC 7946 in August 2016.
Example
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [102.0, 0.5]
},
"properties": {
"prop0": "value0"
}
},
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[102.0, 0.0],
[103.0, 1.0],
[104.0, 0.0],
[105.0, 1.0]
]
},
"properties": {
"prop0": "value0",
"prop1": 0.0
}
},
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[100.0, 0.0],
[101.0, 0.0],
[101.0, 1.0],
[100.0, 1.0],
[100.0, 0.0]
]
]
},
"properties": {
"prop0": "value0",
"prop1": { "this": "that" }
}
}
]
}
{{maplink|frame=yes|frame-align=center|frame-width=300|frame-height=200|from=GeoJSON example.map |frame-latitude=0.7|frame-longitude=102.5|zoom=6|text=GeoJSON example (map data)}} |
=Geometries=
Points are [x, y] or [x, y, z]. They may be [longitude, latitude] or [eastings, northings]. Elevation, in meters,{{Cite report |url=https://datatracker.ietf.org/doc/rfc7946/ |title=The GeoJSON Format |last=Butler |first=H. |last2=Daly |first2=M. |date=August 2016 |publisher=Internet Engineering Task Force |issue=RFC 7946 |last3=Doyle |first3=A. |last4=Gillies |first4=Sean |last5=Schaub |first5=T. |last6=Hagen |first6=Stefan}} is an optional third number. They are decimal numbers.{{cite web |title=GeoJSON RFC #3.1.1|date=August 2016 |url=https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.1 |last1=Butler |first1=H. |last2=Daly |first2=M. |last3=Doyle |first3=A. |last4=Gillies |first4=Sean |last5=Schaub |first5=T. |last6=Hagen |first6=Stefan }}
For example, London (51.5074° North, 0.1278° West) is [-0.1278, 51.5074]
The coordinate reference system for all GeoJSON coordinates is a geographic coordinate reference system, using the World Geodetic System 1984 (WGS 84) [WGS84] datum, with longitude and latitude units of decimal degrees.{{Cite report |url=https://datatracker.ietf.org/doc/html/rfc7946#section-4 |title=The GeoJSON Format |last=Butler |first=H. |last2=Daly |first2=M. |date=August 2016 |publisher=Internet Engineering Task Force |issue=RFC 7946 |last3=Doyle |first3=A. |last4=Gillies |first4=Sean |last5=Schaub |first5=T. |last6=Hagen |first6=Stefan}}
class="wikitable"
|+Geometry primitives |
Type
!colspan="2"| Examples |
---|
Point
| "type": "Point", "coordinates": [30.0, 10.0] } |
LineString
| "type": "LineString", "coordinates": [ [30.0, 10.0], [10.0, 30.0], [40.0, 40.0] ] } |
rowspan="2"| Polygon
| "type": "Polygon", "coordinates": [ [ [30.0, 10.0], [40.0, 40.0], [20.0, 40.0], [10.0, 20.0], [30.0, 10.0] ] ] } |
File:SFA Polygon with hole.svg
| "type": "Polygon", "coordinates": [ [ [35.0, 10.0], [45.0, 45.0], [15.0, 40.0], [10.0, 20.0], [35.0, 10.0] ], [ [20.0, 30.0], [35.0, 35.0], [30.0, 20.0], [20.0, 30.0] ] ] } |
class="wikitable"
|+Multipart geometries |
Type
!colspan="2"| Examples |
---|
MultiPoint
| "type": "MultiPoint", "coordinates": [ [10.0, 40.0], [40.0, 30.0], [20.0, 20.0], [30.0, 10.0] ] } |
MultiLineString
| File:SFA MultiLineString.svg | "type": "MultiLineString", "coordinates": [ [ [10.0, 10.0], [20.0, 20.0], [10.0, 40.0] ], [ [40.0, 40.0], [30.0, 30.0], [40.0, 20.0], [30.0, 10.0] ] ] } |
rowspan="2"| MultiPolygon
| "type": "MultiPolygon", "coordinates": [ [ [ [30.0, 20.0], [45.0, 40.0], [10.0, 40.0], [30.0, 20.0] ] ], [ [ [15.0, 5.0], [40.0, 10.0], [10.0, 20.0], [5.0, 10.0], [15.0, 5.0] ] ] ] } |
File:SFA MultiPolygon with hole.svg
| "type": "MultiPolygon", "coordinates": [ [ [ [40.0, 40.0], [20.0, 45.0], [45.0, 30.0], [40.0, 40.0] ] ], [ [ [20.0, 35.0], [10.0, 30.0], [10.0, 10.0], [30.0, 5.0], [45.0, 20.0], [20.0, 35.0] ], [ [30.0, 20.0], [20.0, 15.0], [20.0, 25.0], [30.0, 20.0] ] ] ] } |
GeometryCollection
| File:SFA GeometryCollection.svg | "type": "GeometryCollection", "geometries": [ { "type": "Point", "coordinates": [40.0, 10.0] }, { "type": "LineString", "coordinates": [ [10.0, 10.0], [20.0, 20.0], [10.0, 40.0] ] }, { "type": "Polygon", "coordinates": [ [ [40.0, 40.0], [20.0, 45.0], [45.0, 30.0], [40.0, 40.0] ] ] } ] } |
Newline-delimited GeoJSON
An alternative to GeoJSON is to encode one geographic feature per line, with line breaks (or record-separator characters) designating the separation between records.
This format can be much faster more efficient to parse than normal GeoJSON, as tooling can read individual records in parallel. This format is similar to newline-delimited JSON.
Variants of newline-delimited GeoJSON include:
- GeoJSONSeq (short for GeoJSON Text Sequences) - with record-separator (RS) characters separating features{{Cite report |url=https://datatracker.ietf.org/doc/html/rfc8142 |title=GeoJSON Text Sequences |last=Gillies |first=Sean |date=April 2017 |publisher=Internet Engineering Task Force |issue=RFC 8142}}
- GeoJSONL (short for GeoJSON Lines) - with newline characters separating features{{Cite web |date=2018-09-11 |title=GeoJSONL: An optimized format for large geographic datasets |url=https://www.interline.io/blog/geojsonl-extracts/ |access-date=2024-11-11 |website=Interline Technologies |language=en}}
TopoJSON
TopoJSON is an extension of GeoJSON that encodes topology. Rather than representing geometries discretely, geometries in TopoJSON files are stitched together from shared line segments called arcs.{{Cite web|url=https://github.com/topojson/topojson-specification|title=topojson/topojson-specification|date=11 December 2020|via=GitHub}} Arcs are sequences of points, while line strings and polygons are defined as sequences of arcs. Each arc is defined only once, but can be referenced several times by different shapes, thus reducing redundancy and decreasing the file size.{{Cite web|url=https://github.com/topojson/topojson|title=topojson/topojson|website=GitHub}} In addition, TopoJSON facilitates applications that use topology, such as topology-preserving shape simplification, automatic map coloring, and cartograms.
A reference implementation of the TopoJSON specification is available as a command-line tool to encode TopoJSON from GeoJSON (or ESRI Shapefiles) and a client side JavaScript library to decode TopoJSON back to GeoJSON again. TopoJSON is also supported by the popular OGR tool as of version 1.11{{Cite web|url=https://trac.osgeo.org/gdal/wiki/Release/1.11.0-News|title=Release/1.11.0-News – GDAL|website=trac.osgeo.org}} and PostGIS as of version 2.1.0.{{Cite web|url=http://postgis.net/docs/AsTopoJSON.html|title=AsTopoJSON|website=postgis.net}}
= TopoJSON Schema =
Given a GIS shape near coordinates latitude 0° and longitude 0°, a simple but valid and complete topojson file containing all metadata, Polygon, LineString, Point elements, arcs and properties is defined as follows:
{
"type":"Topology",
"transform":{
"scale": [1,1],
"translate": [0,0]
},
"objects":{
"two-squares":{
"type": "GeometryCollection",
"geometries":[
{"type": "Polygon", "arcs":0,1,"properties": {"name": "Left_Polygon" }},
{"type": "Polygon", "arcs":2,-1,"properties": {"name": "Right_Polygon" }}
]
},
"one-line": {
"type":"GeometryCollection",
"geometries":[
{"type": "LineString", "arcs": [3],"properties":{"name":"Under_LineString"}}
]
},
"two-places":{
"type":"GeometryCollection",
"geometries":[
{"type":"Point","coordinates":[0,0],"properties":{"name":"Origine_Point"}},
{"type":"Point","coordinates":[0,-1],"properties":{"name":"Under_Point"}}
]
}
},
"arcs": [
]
}
See also
References
Sources
- {{cite web | url=http://www.directionsmag.com/article.php?article_id=2550 | title=Emerging Technology: AJAX and GeoJSON | date=18 September 2007 | first=Christopher | last=Andrews | url-status=dead | archiveurl=https://web.archive.org/web/20090522050557/http://www.directionsmag.com/article.php?article_id=2550 | archivedate=22 May 2009 }}
- {{cite web |url=http://www.geowebguru.com/articles/97-technical-overview-geojson |title=Geoweb Guru: Technical Overview: GeoJSON |date=16 February 2009 |url-status=dead |archiveurl=https://web.archive.org/web/20090221220320/http://www.geowebguru.com/articles/97-technical-overview-geojson |archivedate=21 February 2009 }}
- {{cite web | url=http://googlegeodevelopers.blogspot.com/2009/05/build-on-top-of-your-public-latitude.html | title=Google Geo Developers Blog: Build on top of your public Latitude location with GeoJSON & KML | date=4 May 2009 | first=Chris | last=Lambert}}
External links
- {{Official website|https://geojson.org}}
- [https://geojson.io https://geojson.io]
- [https://geojsonlint.com https://geojsonlint.com]
- [https://github.com/topojson/topojson topojson/topojson]