You are here: Key Concepts > Coordinate Systems and Databases

Coordinate Systems and Databases

If you store, maintain, and analyze spatial data within a database, this topic describes how coordinate systems are modeled in spatial databases.

One common approach is to use the SPATIAL_REF_SYS metadata table defined by the OGC. In this scheme, each coordinate system in use is given a unique local ID (called a Spatial Reference System Identifier, or SRID), which in turn is mapped to a textual description (called “Well Known Text”; see here) and/or a second, centrally registered ID (see EPSG below). Then, each geometry in the database is associated with a SRID: directly, via a second metadata table, or both. (Well Known Text shows up in a number of non-database contexts as well, such as the “.prj” companion to Esri Shapefiles.)

One of the strengths and weaknesses of Well Known Text is that it is underspecified. On the plus side, it is easy to extend – nothing prevents you from adding new projection algorithms, datums, or more. However, not all applications understand all the same terms or refer to the same coordinate systems in the same way. Registries, such as the EPSG, are a big help because they authoritatively assign IDs to commonly used coordinate systems, and these can be referenced in the metadata tables, Well Known Text, and many other contexts. (You can also visit spatialreference.org which contains references in many different formats.)

Coordinate system metadata is most commonly used by GIS software to present data in context (for example, with units or layered over a base map), or to correctly overlay data referenced to different coordinate systems. However, some databases provide additional capabilities. For example, they might be able to reproject data natively, allowing for spatial queries that compare tables using different coordinate systems, or that transform results to a desired coordinate system for a lightweight client. Also, some databases endow a rich set of spatial operators with knowledge of our round world, answering queries like “How far is New York from Paris?” or “What’s the area of an airspace described by a latitude, longitude, and a radius?” while taking into account a coordinate system’s model of the Earth’s shape.

Learning how your database stores and manipulates coordinate systems will help you ensure that you’re storing this metadata correctly. Further, you may discover powerful new ways to transform and query your data.