# How do coordinate systems in QGIS work? [duplicate]

So, I don't really have much knowledge about the coordinate system and sometimes I get stuck in certain things that I just can't get around it. For example, whenever I'm working with a vector that is in UTM and I need to see a raster of that place, I use the plugin to see the google satellite in the background.

But how can it be perfectly placed with the vector? Wasn't it supposed to have like a difference between the two since the vector is in UTM and Google works in another coordinate system? How does that work? I am doing something wrong?

Could someone explain that to me or give me some references that I could be reading to fully understand the subject?

• A coordinate system is nothing but a formula of how to interpret the coordinates and place then on a map/the screen. And since computers are just fancy calculators, they can for example easily calculate how two CRS (formulas) relate to each other and thus display data in different CRS in the correct relation to each other.
– Erik
Oct 28, 2020 at 12:23
• What GIS Software like QGIS does is reads the coordinate system information for all the datasets it is asked to display. As long as the coordinate systems are defined correctly, the software can 'project on the fly' datasets in various coordinate systems. So your map may be in Web Mercator (google), but when you add a dataset in UTM, QGIS does the math to align it with the Google Map. Oct 28, 2020 at 15:43
• Oh, so it automatically converts to another coordinate system, nice. But in case, can it convert the google (web mercator) to UTM also? Cause I take measures in meters whenever I'm with a raster background from google and it seems to pretty spot on, and what I know is that you can't use any other system but UTM to work in meters. Thanks for the answers. It helped me a lot! Oct 28, 2020 at 18:38
• UTM and many other projections do work well in meters, but they all, (including UTM) have distortions that become significant at larger scales. Plain old Mercator (rather than Transverse Mercator) will be pretty spot on near the equator, and the UTMs will be pretty spot on along their central meridians. You can even define Oblique Mercators that will be spot-on along their particular great circles. Oct 29, 2020 at 13:34
• I'd like to add two comments: 1) QGIS sets the project's coordinate system to the first layer added. Layers that are subsequently added are thus Projected on the Fly to match that first layer. 2) "Project on the Fly" only applies to the map display (e.g. on-screen, paper and pdf output) of the layers. It does not come into play when data is analyzed (e.g. merging two layers with differing coordinate systems, or calculating distances between them). For any analysis involving multiple layers, they must have the same coordinate system. Nov 4, 2020 at 17:05

How QGIS coordinates work depends on how you use it.

QGIS has a project Coordinate Reference System (set under Project/Properties/Set CRS) that it uses to represent each layer that it displays in its window. Each layer, whether vector, or raster could have a different CRS, and QGIS will reproject the data to match the main CRS.

Below is an example of QGIS reprojecting Google's Hybrid raster layer onto this project's Oblique Mercator (it's central axis is tilted at -55 degrees through Virginia, USA*) and it distorts the raster.

Since QGIS knows the projection it is using, if you use it to measure distances between points, it can calculate the distance along the ellipsoid associated with the projection (by default) or can calculate the distance in plan view (non-default).

• This local coordinate system is an Oblique Mercator CRS. It is set under `Settings/Custom Projections` using this proj string:

+proj=omerc +lat_0=37.204392 +lonc=-76.497682 +alpha=-55 +gamma=0 +k=1 +x_0=0 +y_0=0 +ellps=WGS84 +units=m +no_defs

A layman way of explaining what QGIS is doing.

Imagine you have a photo of your house. Lets say its an aerial photo that you got from Google Maps (except a bit better quality and resolution. Now lets also say that you have house plans of your house. On an A4 piece of paper.

Your house plans won't be at the same scale or possibly even same orientation as your photo. The two could be described as being in different 'map projects' (or coordinate systems for simplicity sake).

The process of aligning them would be to rotate, resize and move around the pieces of paper around, such that they line up and that the house plans would fit at the same scale, orientation etc, as the aerial photo, eventually 'lining up'.

What QGIS does, is the above, but it does it automatically, as long as it knows the source coordinate systems.

The process of doing this is called reprojection. and there is some funky maths behind it, and if you really want to learn this, the topic of geodesy would be your starting point (and your first lesson is that the earth is not round. LOL.... its a potato!).

Hope the above helps.