Working with Projections in QGIS

Understanding, Changing, and Creating Coordinate Systems

Alexander Arroyo
Beyond the Anthropocene
10 min readApr 21, 2022

--

Projections are powerful, complex, and often frustrating. This is a brief introduction to “first steps” with projections and coordinate systems.

QGIS will automatically set your project Coordinate Reference System (CRS) based on the projection specified by the first shapefile, geojson, or other spatial data file format you bring into your project. Here we’re using a few new vector layers in the class DATA folder from Natural Earth, a good source for basic geometries like countries, the global shoreline, land, and metageographical geometry like graticules (latitudinal and longitudal grid lines). Here we’re just bringing in the “land” dataset at 1:50 million scale. Note that because this lab is focused on global datasets, it’s okay to use a dataset with significant generalization — that is, the geometry is simplified for the purposes of use at medium to small scales (i.e., at regional, continental, or global scale). To check which CRS you’re in, find the CRS dialogue in the bottom right corner of the window.

CRS information to the right.

There will be a letter and number code, here EPSG:4326, indicating which projection is currently set for viewing your data. Don’t be intimidated by the code; this simply means that there’s an organization responsible for this projection (European Petroleum Survey Group), followed by a number string assigned to easily identify the projection (some projections have multiple, varying versions, so this number helps clarify which exact version you’re using). Click the CRS button to open the project CRS dialogue; you’ll see any recently used CRSs, a library of predefined CRS options that come with QGIS (over 7,000!), and the specific information about what CRS is in current use.

From there, you can verify that this CRS is specified in the dataset you’ve loaded into your map. Double click the data layer (or right click and select properties); click the information tab and find the CRS heading. The CRS info for the dataset should match up with the what already appeared in the map CRS dialogue.

Check your projection!

There are many projections for many uses; some are created by governmental agencies for use at a very specific scale (for example, each state has its own CRS that is optimized to minimize distortions for that scale), while others are meant for global use. The one we’re using, WGS84, is the standard CRS for global use, and is specified by the majority of global datasets. The details of each unique projection are often complex, driven by particular historical and geographic needs (navigation, for instance). There are entire books written about the history of particular projections, and this lab skips those richer accountings entirely. Projections are also mathematically complex, given that many do not conform to a simple Cartesian coordinate plane or Euclidean geometries; such is the nature of transforming a three-dimensional object into a two-dimensional one. Similarly, this lab does not go into the technical details of how projections are constructed mathematically, nor how that mathematical construction is encoded computationally. If you are interested in any of these dimensions, let us know!

Without a more in-depth way of comparing projections, we’ll use a shortcut: a lat-long grid, known as graticules. We’ve prepared a selection of graticules representing regular increments in geographic degrees; here we’ll load in a set at a 5-degree increment and a 20-degree increment. Because the graticules overlap (20 is a multiple of 5), you’ll need to restyle one of the layers in order to distinguish them from one another. We’ve covered this in previous labs; simply double click the layer, select symbology, and change your stroke width, color, etc.

Adding graticules.

The next step is to change projections. While there are quite a few complicated steps going on behind the QGIS curtain, from the user’s point of view it’s a fairly straightforward process. Click the Project CRS button (bottom right of window) to bring up the Project CRS dialogue. If you scroll through the Predefined Coordinate Systems, you’ll find three top-level categories: Geographic Coordinate Systems, Projected Coordinate Systems, and User-Defined. WGS84 is a geographic coordinate system, meaning it uses lat-long degrees as its unit of measurement for determining locations. This is because those coordinates are located on a 3D object and projected into 2D space. Projected coordinate systems, however, are already projected into 2D space, and are therefore measured in metric units (e.g., meters). Moving between the two can sometimes cause QGIS a bit of trouble (as we’ll see). For the purposes of this example, let’s choose David Aitoff’s 1889 projection, which preserves proportionally correct distance from a center point (useful for the time to chart nearness to a “global center”). You can find Aitoff’s projection by searching in the Filter dialogue, or by scrolling to find it. There are a lot of predefined projections, so you may just want to search using the filter! Select the World Aitoff and notice a few things: first, that it’s assigned the ESRI:54043 identifier (indicating this has been created by ESRI of ArcGIS fame/infamy); second, that in “properties” you can verify that it’s using meters as a unit of measurement, and is therefore a projected coordinate system; third, you can see the center point (indicated by a small purple cross) and an overall extent (in degrees). Now let’s click Apply (and/or OK) to see what it does!

Exploring projection properties

We can see using the lat-long grid as reference that the Aitoff projects the globe onto an ellipse. Each projection target-shape and strategy involves distortion of size, angle, and/or shape of geographic features. This is most recognizable with the ubiquitous Mercator projection, invented to aid colonial and imperial European navigation from Europe to the equatorial regions. Find the WGS-based Mercator projections; note that there are two (Pseudo-Mercator, centered on the Atlantic, and “PDC”, centered on the Pacific); the graphical summary to the right will show the extent and focus of each. Try switching to WGS84 / Pseudo-Mercator; the latitudinal grid maintains regular spacing near the equator, but is significantly distorted toward the poles. If you’re unsure how different projections warp the lat-long grid, use your graticules to help develop a more intuitive sense of what’s going on mathematically.

Check distortions.

Next we’ll explore some additional Projected Coordinate Systems and try to get a sense for how QGIS processes different projection geometries. Take the Azimuthal Equidistant projection, for example. We’ve actually already explored one version through Aitoff, which is a particular take on the “AEQD.” You can find a list of generic AEQD projections by searching for azimuthal.

Explore the information about the projection in the text box to the left of the graphical representation; beneath the properties we looked at above, you’ll find the WKT and Proj4 strings that tell QGIS how to interpret the projection computationally, and the Extent information. You don’t need to worry about this right now, but take note of the location and formulation of the Proj4 string; we will use this to create a custom CRS later!

After you’ve applied the transformation to Azimuthal Equidistant, you’ll notice that something weird is happening with the graticules; they’re connecting in places they shouldn’t! Unfortunately this is a quirk of QGIS for which there’s no quick fix. Whatever geometry QGIS perceives to be “behind” what is projected behaves in strange ways that often result in the artifacts you see here, or in improperly filled polygons. This is something you can fix through more technical means in QGIS, or that you can fix by editing the linework in Illustrator. We can troubleshoot this on a case-by-case basis.

Now let’s imagine a case in which the standard projections available don’t quite work for the geographies I want to represent centrally. You’ll often find this problem in relation to the Pacific Ocean and the Southern Hemisphere; such is the technical legacy of European imperial cartography.

In this case, let’s work around the Pacific. If we don’t already have precise lat-long coordinates to center our projection, we can always look at the coordinate dialogue in the bottom toolbar.

If you’re seeing meters rather than degrees, it’s likely because you’re in a Projected Coordinate System; you can change this in the Project > Properties > General Settings > Coordinate and Bearing Display > Display Coordinates Using, and change your units to degrees. This will give you an interactive way to find the center point you may want to build your map around.

Now it’s time to try creating a custom projection that centers on our desired area of focus. For visual clarity, let’s simplify the style. If we use certain projections — for instance, the orthographic “World From Space” — we’ll likely run into some of the same geometry-artifact problems as before. Try bringing in a coastline layer for reference in comparing how the land polygon geometries behave. You can see there’s a problem with rendering the northern coast of Eurasia/Russia properly.

To create our custom projection, let’s look at the projection information more closely, focusing on the Proj4 string. The string is constructed more simply (though less comprehensively) than the WKT string, which makes it a bit easier to use at this stage. Notice that there is a lat value and a long value in the string, indicated by the +lat_0= and +lon_0= strings. These are the origin coordinates for the center of the projection. If we copy the whole string and modify only these values, we’ll be able to create a custom orthographic projection with a center point of our choosing.

This is more clearly illustrated using one of the polar orthographic projections, in this case, centered over the North Pole. After applying this projection, we can see that the geometry is a little cleaner, though there’s still a clipping artifact on the bottom right.

Navigate to the Proj4 string for the North Pole Orthographic projection. Now copy the string only, not the Proj4 header.

With the string copied, navigate to Settings > Custom Projections. Click the plus sign to add a new projection and give it a descriptive title. Next, select Proj string from the Format submenu. Don’t worry about the “legacy” warning. Paste the copied Proj4 string into the Parameters. Now change your +lat_0= and +long_0= origins to coordinates of your choice. Then click OK.

Only one step remaining — change to your new projection! Open up the Project CRS dialogue and find your custom projection. You’ll notice that the WKT has been automatically generated, and the Proj4 string should match whatever you input in the previous step. Apply the projection change and check your map. You can modify your custom projection by going back into the Custom Projections dialogue and changing the parameters (including, if you wish, specifying the extent, which is not automatically reset). Now experiment and don’t be afraid to break things!

Because this lab only involves comparing projections (rather than creating original maps), we’d like everyone to use the same styles and layers for their maps. We’ve supplied the set of styles for each layer in the DATA \ QGIS Styles folder, accessible here.

You can make the manual changes by going a bit deeper into the symbology options. This includes creating dashed lines…

Creating custom gradients… and saving your styles that you can load up in any map… This may be useful for coordinating map work with your group.

Depending on your assigned projection, your final maps should look something like this:

ASSIGNMENT OVERVIEW

This week’s exercise is a quick comparative analysis of the world projections, intended to serve as a resource for the class. For {L04} you will be assigned a specific map projection: your job is to familiarize yourself with it and do some background research, including its history, intended use(s), and properties.

After becoming familiar with it, produce a simple map of the world using the following shapefiles:

  • ne_50m_land.shp
  • ne_10m_coastline.shp
  • ne_110m_graticules_5.shp
  • ne_110m_graticules_20.shp

In order to have consistency across the board, and be able to draw lines of comparison, your composition should use the same styles as the tutorial.

DELIVERABLES

For your {L04} post to the Lab WIP channel in Are.na (due Thursday, 4/28 at 9 am):

  1. After producing a world map using the assigned projection and style, export your drawing as an SVG with a height of 1080 pixels (customize the width according to your projection, but it should be no less than 1080 pixels)
  2. Give your block the name of your projection
  3. In your description, include the following:
  • Brief historical background of the projection: when and why was it developed, and by whom?
  • Its intended uses: what is it suitable for, but also, what is it not suitable for?
  • Did you experience any problems with this projection in QGIS?

--

--