Coordinate Reference Systems and Projections
A coordinate reference system connects coordinate tuples to positions. A geographic CRS uses angular coordinates on an ellipsoid; a projected CRS maps a region to a plane. The projection cannot preserve every property at once: distance, area, direction, and shape distort differently across space.
Prerequisites
Complete coordinates, geometry, and spatial questions. You should know which feature, extent, and measurement the analysis needs.
Learning goals
- Distinguish assigning CRS metadata with
set_crsfrom transforming coordinates withto_crs. - Inspect authority codes, axis definitions, units, and area of use.
- Explain why longitude-latitude degrees are not planar metres.
- Identify axis-order, distortion, antimeridian, and transformation-grid risks.
Assignment is not transformation
set_crs(...) says what existing numbers mean. It must not move them. Use it only when reliable provenance establishes the missing CRS. to_crs(...) calculates new coordinate values in a target CRS. Relabeling longitude-latitude values as metres with set_crs("EPSG:32633", allow_override=True) does not project them; it corrupts their meaning.
This batch stores GeoJSON-style coordinates in OGC:CRS84, whose data order is longitude, latitude. EPSG:4326 describes the same WGS 84 geodetic frame but its authority axis order is latitude, longitude. GeoPandas geometry coordinates follow x, y convention and handles supported transformations through pyproj. When calling pyproj directly, inspect the CRS axes and use always_xy=True only when you intentionally choose traditional GIS x/y order.
For the Berlin teaching extent, WGS 84 / UTM zone 33N (EPSG:32633) provides metre coordinates and modest local distortion. It is not a universal “accurate CRS”: it has an area of use, and a different region or an area-preserving task may need another projection. Record why the target CRS fits the extent and quantity.
Worked example
import json
from pathlib import Path
import geopandas as gpd
from pyproj import CRS
path = Path("tests/fixtures/geospatial-data-science/places.geojson")
document = json.loads(path.read_text(encoding="utf-8"))
places = gpd.GeoDataFrame.from_features(document["features"])
before = tuple(places.geometry.iloc[0].coords)[0]
assigned = places.set_crs(document["metadata"]["crs"])
after_assignment = tuple(assigned.geometry.iloc[0].coords)[0]
projected = assigned.to_crs("EPSG:32633")
after_transform = tuple(projected.geometry.iloc[0].coords)[0]
axis_directions = ",".join(axis.direction for axis in CRS.from_epsg(4326).axis_info)
unit = projected.crs.axis_info[0].unit_name
print(f"assigned={assigned.crs.to_string()} projected={projected.crs.to_string()}")
print(f"set_crs_moves={before != after_assignment} to_crs_moves={before != after_transform} units={unit}")
print(f"epsg4326_authority_axes={axis_directions} data_order=longitude,latitude")
Expected output:
assigned=OGC:CRS84 projected=EPSG:32633
set_crs_moves=False to_crs_moves=True units=metre
epsg4326_authority_axes=north,east data_order=longitude,latitude
The Boolean checks make the semantic difference observable. They do not prove that the assigned CRS is correct; that evidence comes from the data contract and source metadata.
Distortion and difficult boundaries
Compare projected results with a geodesic calculation or another appropriate projection when decisions are sensitive to error. Inspect the target CRS area of use and the selected transformation. High-accuracy datum changes may depend on grid files; unavailable grids can change the operation or accuracy. Keep PROJ network downloads disabled in deterministic, offline verification unless grids are deliberately vendored and licensed.
GeoPandas transforms the vertices of a geometry, not an imagined geodesic curve between sparse vertices. A segment from longitude 179.8 to -179.8 can be drawn the long way across a planar map unless it is split or densified with explicit antimeridian logic before projection. No single global projected CRS makes all distance and area calculations safe.
Limitations and common mistakes
- EPSG codes identify definitions; they do not guarantee that coordinates were captured in that CRS.
- A displayed CRS name does not prove axis order was handled correctly at every external boundary.
- Projection distortion grows away from the design region and differs by property.
- Vertical coordinates, coordinate epoch, and dynamic datums need more metadata than this 2D fixture carries.
to_crsis not a datum-quality audit and does not repair invalid geometry.
Practice
Write a CRS decision note for a continental area calculation and for a 500 m local buffer. Include source CRS, target CRS, area of use, units, preserved property, expected distortion, axis convention, and transformation dependencies.
Next steps
Next, compare vector and raster data and the different spatial support each representation stores.
Primary sources
Checked 2026-10-18: GeoPandas, projections guide; PROJ, axis-order and CRS FAQ; pyproj, Transformer.from_crs and always_xy; PROJ, projection units and parameter behavior.