{"canonical_url":"https://engineer.company/glossary/gdal/","content_markdown":"# GDAL\n\n## What it is\n\nGDAL, short for Geospatial Data Abstraction Library and often written GDAL/OGR,\nis open-source software that opens map data stored in one format and writes it\nout in another, reprojecting it on the way when asked. Its own documentation\ncalls it a translator library.\n\nSpatial data comes in two shapes. Raster data is a grid of cells: a satellite\nimage, an aerial photo, an elevation model. Vector data is points, lines and\npolygons with attributes attached: addresses, roads, parcel boundaries. GDAL\ngives the program that calls it one abstract model for each shape, and behind\nthat model sits a driver per format. GeoTIFF, JPEG 2000 and NetCDF are drivers\non the raster side; Shapefile, GeoJSON, GeoPackage, KML and PostgreSQL tables\nare drivers on the vector side, and there are many more of both. A program\nwritten against GDAL reads all of them through the same calls.\n\nThe vector half was known for years as OGR, and the two halves kept separate\ndriver structures until GDAL 2.0 merged them. That history is why the vector\nprograms still carry the old prefix: `ogrinfo` describes a vector dataset and\n`ogr2ogr` converts one. Work on the library began in late 1998 with Frank\nWarmerdam. It is released under an MIT-style licence and is a project of the\nOpen Source Geospatial Foundation, OSGeo.\n\nThere are three ways to use it. The first is the command line, through programs\nsuch as `gdalinfo`, `gdal_translate` and `gdalwarp` for rasters and `ogrinfo`\nand `ogr2ogr` for vectors. Since version 3.11 there is also a single `gdal`\ncommand with subcommands such as `gdal raster` and `gdal vector`, which the\nproject still marks as provisional. The second is code, through bindings for\nPython and other languages. The third is inside other software: QGIS, for\nexample, reads its vector formats through the GDAL drivers and offers the GDAL\nprograms in its Processing toolbox. A typical conversion fits on one line, here\nturning a shapefile into a GeoPackage and reprojecting it to the UTM zone used\nacross Denmark:\n\n```sh\nogr2ogr -f GPKG -t_srs EPSG:25832 parcels.gpkg parcels.shp\n```\n\nAt the time of writing the current release is 3.13.3. Few tools compete at this\nlayer. ArcGIS ships its own conversion tools and single formats have small\nreaders of their own, but a team that must accept whatever a client sends tends\nto end up with GDAL in its stack, often through a library that depends on it.\n\n## Why it matters\n\nEvery geospatial system has a border where outside data comes in: a\nmunicipality's shapefiles, a surveyor's GeoTIFFs, a partner's GeoJSON export, a\nKML file someone drew in a browser. The decision GDAL bears on is who stands at\nthat border. It can be a person clicking through a desktop tool, or a script\nthat does the same thing every time. GDAL is what makes the script cheap to\nwrite.\n\nA conversion written as an `ogr2ogr` or `gdalwarp` command can be read in\nreview, kept in version control and run again when the next delivery arrives. A\nconversion done by hand is done once, by whoever remembers the steps. For data\nthat arrives in batches, month after month, that difference decides whether\nquality holds.\n\nThe licence matters too. There is no per-seat fee and no vendor approval, and\nthe same tool runs on a laptop, a build server and inside a container.\n\nThe third reason is reach into storage. GDAL's virtual file systems let a driver\nread data where it lies. With the `/vsicurl/` prefix it reads a file over HTTP\nby asking for byte ranges, so most drivers consume a remote dataset piece by\npiece without downloading all of it, and `/vsis3/` does the same against Amazon\nS3. Pair that with a Cloud Optimized GeoTIFF, which is tiled, carries its own\noverviews and is laid out to keep the number of requests low, and a raster of\nmany gigabytes can sit in object storage and still be read one window at a time.\n\nThe costs are real as well. GDAL is a large native library with many optional\ndependencies, and which drivers a given build contains depends on how it was\ncompiled, so two machines that both “have GDAL” can open different formats. And\nit translates faithfully, which includes faithfully carrying over every limit of\nthe format it is asked to write.\n\n## What it looks like in practice\n\nGDAL appears on two projects on this site, in two different roles.\n\nFrom 2015 to 2022, as GIS Software Development Team Lead, delivery ran on\n[more than thirty GIS projects, each one supported in production after it shipped](/portfolio/led-30-gis-projects-from-build-to-support/).\nUnderneath them sat PostgreSQL with PostGIS for the spatial data, and GDAL/OGR\nwas the tool for moving that data between formats: shapefiles, GeoJSON, GeoTIFF,\nKML and vector tiles. QGIS and JOSM handled the data work itself, and the maps\non top were built with Mapbox GL and Leaflet. Both halves of the library were in\nuse, since GeoTIFF is raster and the rest of that list is vector, and the\nprojects themselves ranged from 2D and 3D digital mapping and LiDAR processing\nto georectification, vectorisation, indoor mapping and navigation.\n\nFrom 2022 to 2024, in a Data Engineer role on a large-scale geospatial analytics\nproject, GDAL was one of the tools for finding and fixing errors.\n[Spatial errors were diagnosed and corrected with GDAL, QGIS and ArcGIS](/portfolio/resolved-1000-issues-in-geographical-data/),\nand because the same cleaning tasks kept coming back, they were automated as\nBash scripts. PostGIS carried the spatial queries and indexes, procedures in\nPL/pgSQL and Transact-SQL transformed the data inside PostgreSQL and SQL Server,\nand the cleaned result fed interactive visualisations built with Mapbox. With\nGDAL in the toolkit, the cleanup resolved more than 1,000 issues, and it was one\nof the reasons spatial query run times came down by 35%.\n\n## Where it goes wrong\n\nGDAL does exactly what it is told. Most trouble starts when it is told something\nslightly different from what was meant.\n\n**Points land on the wrong continent.** Since GDAL 3.0 the library honours the\naxis order set by the authority that defines a coordinate system, and for\nEPSG:4326, the familiar latitude and longitude system, that order is latitude\nfirst. Code written for GDAL 2 passes longitude first, and so does GeoJSON. Mix\nthe two and every pair is swapped: a point in Copenhagen reappears in the\nArabian Sea. Decide on one order at the edge of the program and state it. In\ncode that wants longitude first, the documented switch is\n`SetAxisMappingStrategy(OAMS_TRADITIONAL_GIS_ORDER)` on the spatial reference.\n\n**Column names come out cut short and dates lose their time.** A shapefile keeps\nattribute names to 10 characters. GDAL shortens longer names as it writes, and\nwhen two shortened names collide it cuts them to 8 characters and adds a serial\nnumber, so `abcdefghijkl` becomes `abcdefgh_1`. The format stores dates without\ntimes. GDAL recommends keeping `.shp` and `.dbf` files at 2 GB or less for\ninteroperability with other software. Danish or Cyrillic text can turn to noise\nif its encoding is misidentified when the `.cpg` file that names the code page\nis missing. Write GeoPackage\nwhere the receiver allows it; where a shapefile is required, rename the columns\non purpose before converting.\n\n**A remote raster is downloaded whole.** Given a plain `https://` address with\nno prefix, GDAL picks its HTTP pseudo-driver, which pulls the entire file into\nmemory before any driver reads it. That suits a small file and is the wrong\nchoice for a national orthophoto. Prefix the address with `/vsicurl/` so the\ndriver fetches only the byte ranges it needs, and store large rasters as Cloud\nOptimized GeoTIFF so those ranges are few. Then leave the file alone: editing a\nCOG in place breaks its layout, and since GDAL 3.8 an attempt to open one for\nupdate is refused unless that break is explicitly allowed.\n\n**A CSV's numbers arrive as text.** The CSV driver reads every field as a string\nunless told otherwise, so a column of populations sorts alphabetically and a sum\ndownstream turns into a type error. Set the `AUTODETECT_TYPE=YES` open option,\nor ship a `.csvt` file beside the CSV that names each column's type.\n\n**An upgrade breaks the Python import.** The `gdal` package on PyPI is built\nagainst the GDAL already installed on the machine, so the two versions have to\nagree. The project's install instructions pin one to the other:\n\n```sh\npip install gdal[numpy]==\"$(gdal-config --version).*\"\n```\n\n## Further reading\n\n- [GDAL documentation](https://gdal.org/en/stable/) — the project's own\n  description of the translator library, its drivers and its licence.\n- [Programs](https://gdal.org/en/stable/programs/index.html) — every\n  command-line tool, from `gdalinfo` and `ogr2ogr` to the newer `gdal` command.\n- [GDAL Virtual File Systems](https://gdal.org/en/stable/user/virtual_file_systems.html)\n  — `/vsicurl/`, `/vsis3/` and the other prefixes for reading data where it\n  lies.\n- [OGR Coordinate Reference Systems and Coordinate Transformation tutorial](https://gdal.org/en/stable/tutorials/osr_api_tut.html)\n  — with the section on axis order and what changed in GDAL 3.0.\n- [COG – Cloud Optimized GeoTIFF generator](https://gdal.org/en/stable/drivers/raster/cog.html)\n  — the file layout, its overviews and why editing in place undoes them.\n\n\u003chttps://engineer.company/glossary/gdal/\u003e\n","date_modified":"2026-11-08T05:31:18Z","description":"What GDAL does inside a geospatial stack, when ogr2ogr and gdalwarp earn their place, and the axis-order and format traps that bend converted data.","formats":{"gemtext":"https://engineer.company/glossary/gdal/index.gmi","gopher":"https://engineer.company/glossary/gdal/gophermap","html":"https://engineer.company/glossary/gdal/","json":"https://engineer.company/glossary/gdal/index.json","markdown":"https://engineer.company/glossary/gdal/index.md","pdf":"https://engineer.company/glossary/gdal/index.pdf"},"kind":"page","language":"en","title":"What is GDAL?","url":"https://engineer.company/glossary/gdal/","version":1}