GeoJSON and Common GIS Data Formats

Read GeoJSON structures, recognize common vector and raster formats, and understand where each format fits.

🎯 Introduction

By the end of this article, you will be able to read GeoJSON geometries, features, and attributes, and distinguish Shapefile, GeoPackage, KML, and GeoTIFF.

🧩 Why Does GIS Have So Many Formats?

Map data can appear as objects in web APIs, desktop GIS files, remote sensing imagery, or exchange files. Formats make different tradeoffs in file size, attribute structure, editing capabilities, and software compatibility.

🧱 GeoJSON Structure

A Geometry describes a shape, properties stores attributes, a Feature combines the two, and a FeatureCollection contains multiple features.

This structure addresses three practical needs in web maps: geometry tells the map where to draw, properties support popups and filters, and a feature’s id supports selection, updates, and links to detailed information.

{
    "type": "FeatureCollection",
    "features": [
        {
            "type": "Feature",
            "id": "station-a",
            "properties": { "name": "Station 1", "temperature": 18 },
            "geometry": { "type": "Point", "coordinates": [116.4, 39.9] }
        }
    ]
}

GeoJSON normally uses [longitude, latitude]. A Point contains one coordinate position, a LineString contains an array of positions, and a Polygon contains an array of rings. MultiPoint, MultiLineString, and MultiPolygon allow one object to contain multiple geometries of the same type.

The first ring of a Polygon is the exterior ring; subsequent rings can represent holes. Rings must be closed: the last position must match the first. A hole is not another polygon; it is an area inside the exterior ring that does not belong to the polygon.

Exterior and interior rings accurately represent open spaces within parks, bodies of water, or buildings. Omitting a hole fills an area that should be excluded as though it belonged to the polygon.

🗂 Common GIS Formats

FormatTypeCommon uses
GeoJSONJSON vector formatWeb APIs and small data exchanges
ShapefileVector format made up of companion filesTraditional GIS data exchange
GeoPackageSQLite containerStore multiple spatial layers in one file
KMLXML vector markupGlobe viewers and simple annotations
GeoTIFFGeoreferenced rasterRemote sensing imagery, DEMs, and continuous values

A format name does not replace documentation about the CRS, units, or fields. After reading a file, verify its coordinate reference system, coverage, time, and NoData conventions.

🧾 Summary

  • A Feature is a complete object combining geometry and attributes.
  • A FeatureCollection contains multiple features.
  • A Polygon uses exterior and interior rings to represent holes.
  • GeoJSON suits web data exchange, GeoTIFF suits rasters, and other formats have their own use cases.

❓ Knowledge Check

Q1: What is the difference between a Geometry and a Feature?

A Geometry describes only the shape. A Feature also includes attributes and object identity.

Q2: Does longitude always come first in GeoJSON coordinates?

RFC 7946 specifies longitude, latitude order for GeoJSON. Still, check the documentation for the API you use.

🧪 Exercise

Change the example’s Point to a Polygon and add type and observedAt properties.

// Write your code here

🎉 You can now read common WebGIS data formats!