
A lightweight data-interchange format for encoding geographic data structures, GeoJSON extends JSON to include data about geographical features and their non-spatial attributes. It is widely used in web mapping and geographic information systems (GIS) due to its simplicity, ease of use, and compatibility with web technologies.
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-86.13379, 39.7684]
},
"properties": {
"name": "Monument Circle, Indianapolis"
}
}
{
"type": "Feature",
"geometry": {
"type": "MultiPoint",
"coordinates": [
[-86.13379, 39.7684], // Monument Circle
[-86.15804, 39.76638] // Indiana Statehouse
]
},
"properties": {
"name": "Landmarks in Indianapolis"
}
}
{
"type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[-86.16211, 39.77675], // Start of the Cultural Trail
[-86.15383, 39.77083],
[-86.14528, 39.76389] // End near Mass Ave
]
},
"properties": {
"name": "Section of the Indianapolis Cultural Trail"
}
}
{
"type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[-86.16404, 39.79518],
[-86.13256, 39.79518],
[-86.13256, 39.76121],
[-86.16404, 39.76121],
[-86.16404, 39.79518]
]
]
},
"properties": {
"name": "Approximate boundary of downtown Indianapolis"
}
}
{
"type": "Feature",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[-86.2, 39.8],
[-86.1, 39.8],
[-86.1, 39.7],
[-86.2, 39.7],
[-86.2, 39.8]
]
],
[
[
[-86.3, 39.9],
[-86.2, 39.9],
[-86.2, 39.8],
[-86.3, 39.8],
[-86.3, 39.9]
]
]
]
},
"properties": {
"name": "Two separate areas near Indianapolis"
}
}
Basic Data Structures
GeoJSON supports several basic data structures to represent different types of geographic features:
- Point: Represents a single location on Earth. Example:
“`json { "type": "Feature", "geometry": { "type": "Point", "coordinates": [-86.13379, 39.7684] }, "properties": { "name": "Monument Circle, Indianapolis" } } “`
- MultiPoint: Represents a collection of points. Example:
“`json { "type": "Feature", "geometry": { "type": "MultiPoint", "coordinates": [ [-86.13379, 39.7684], // Monument Circle [-86.15804, 39.76638] // Indiana Statehouse ] }, "properties": { "name": "Landmarks in Indianapolis" } } “`
- LineString: Represents a sequence of connected points, forming a line or path. Example:
“`json { "type": "Feature", "geometry": { "type": "LineString", "coordinates": [ [-86.16211, 39.77675], // Start of the Cultural Trail [-86.15383, 39.77083], [-86.14528, 39.76389] // End near Mass Ave ] }, "properties": { "name": "Section of the Indianapolis Cultural Trail" } } “`
- Polygon: Represents an enclosed area, defined by a series of connected points that form a closed ring. The first and last points are the same, closing the shape. Example:
“`json { "type": "Feature", "geometry": { "type": "Polygon", "coordinates": [ [ [-86.16404, 39.79518], [-86.13256, 39.79518], [-86.13256, 39.76121], [-86.16404, 39.76121], [-86.16404, 39.79518] ] ] }, "properties": { "name": "Approximate boundary of downtown Indianapolis" } } “`
- MultiPolygon: Represents a collection of polygons, potentially with holes or multiple disconnected areas. Example:
“`json { "type": "Feature", "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [-86.2, 39.8], [-86.1, 39.8], [-86.1, 39.7], [-86.2, 39.7], [-86.2, 39.8] ] ], [ [ [-86.3, 39.9], [-86.2, 39.9], [-86.2, 39.8], [-86.3, 39.8], [-86.3, 39.9] ] ] ] }, "properties": { "name": "Two separate areas near Indianapolis" } } “`
Key Components
- Coordinates: An array representing the geographic coordinates (longitude, latitude) of the feature.
- Properties: An optional object containing additional information about the feature, such as its name or other attributes.
Applications
GeoJSON is widely used in web mapping and GIS applications due to its simplicity, ease of use, and compatibility with web technologies. It is a standard format for representing geographic data in web applications, allowing for easy integration with mapping libraries and APIs.