Get startedGet started for free

Coordinate Reference Systems

1. Coordinate Reference Systems

Up to now, we have used geometry data with certain coordinates without further wondering what those coordinates mean or how they are expressed.

2. Coordinate Reference System (CRS)

For example, how do you know that the coordinates of this point correspond to the Eiffel Tower in Paris? This is defined by the coordinate reference system or CRS: the reference system relates the coordinates to an actual place on earth.

3. Geographic coordinates

The most known type of coordinates are geographic coordinates: we define a position on the globe in degrees of latitude and longitude, relative to the equator and the prime meridian. With this system, we can easily specify any location on earth. It is used widely, for example in GPS. If you inspect the coordinates of a location in Google Maps, you will also see latitude and longitude. One important caveat, however, to be aware of: you will often see this written as (latitude, longitude), but in Python we use the (longitude, latitude) order. Also note that the longitude is limited to the range of -180 to 180, and the latitude from -90 to 90 degrees.

4. Maps are 2D

Although the earth is a globe, in practice we usually represent it on a flat surface: think about a physical map, or the figures we have made with Python on our computer screen. Going from the globe to a flat map is what we call a *projection*.

5. Projected coordinates

We project the surface of the earth onto a 2D plane so we can express locations in cartesian x and y coordinates, on a flat surface. In this plane, we then typically work with a length unit such as meters instead of degrees, which makes the analysis more convenient and effective. However, there is an important remark: the 3 dimensional earth can never be represented perfectly on a 2 dimensional map, so projections inevitably introduce distortions. To minimise such errors, there are different approaches to project, each with specific advantages and disadvantages.

6. Projected coordinates - Examples

Some projection systems will try to preserve the area size of geometries, such as the Albers Equal Area projection.

7. Projected coordinates - Examples

Other projection systems try to preserve angles, such as the Mercator projection, but will see big distortions in the area.

8. Projected coordinates - Examples

Every projection system will always have some distortion of area, angle or distance. As an illustration, consider this map, which uses the Web Mercator projection. The animation shows the size of the countries using this projection, compared to the actual size, which is for some countries much smaller.

9. Specifying a CRS

A coordinate reference system, geographic or projected, is defined by a set of parameters, which can be described in different ways. One of the representations is the proj4 string. In python, you will also see it represented as a dictionary. It is however out of scope to go in more detail on each of the parameters. Luckily, most coordinate reference systems are also identified by a number in the EPSG system. The CRS shown here in the example is EPSG:4326, also called WGS84. A number and name to remember, as this is the most popular coordinate reference system. If you encounter degrees of latitude and longitude, they are very likely expressed in WGS84.

10. CRS in GeoPandas

In GeoPandas, the CRS information is stored in the crs attribute, and what is returned is the proj4 string or dictionary.

11. Summary

In this chapter, we have learned the difference between geographic coordinates in degrees and projected coordinates in meters. The coordinate reference system determines how coordinates relate to an actual location on earth, and GeoPandas stores this information in the crs attribute. Of all, the WGS84 CRS is the most common one. Let's do a first exercise on that.

12. Let's practice