QGIS XYZ Tiles – Understanding Projections and XYZ Tiles in QGIS 3

coordinate systemopenstreetmapqgis

I have found XYZ layers seem to ignore projections or can't seem to use them. I want to operate using a projection so I can buffer point data, for example. I was attempting to use ESRI:102171 because my data is from Victoria. But even using EPSG:3857 and setting as a projection re-projects my other data but does not effect XYZ layers. In other words the basemaps are in one spot and my data is elsewhere. If I return my layers to CRS EPSG:3857 they all line up. Can XYZ tiles not work with projections?


The problem started when, after I had the map set up perfectly using EPSG:4283 (GDA94 – Australia), I tried to buffer my point data by 50m. As the project was in a CRS and not projection the only option was to use degrees when buffering. I then used ESRI:102171 projection to resolve this. XYZ layers didn't come to the party, so to speak. So, I can have a nice map with XYZ tiles and not be able to perform buffer and other operations OR perform these operations in meters without XYZ tiles to support my work. This is my question, can I have both?

I also tried working from EPSG:3857 and using this for projections which had my data lining up but XYZ tiles not complying. QGIS automatically projects on the fly as far as I understand. I just can't get data to match up with XYZ tiles once projected into a local projection.

Best Answer

At first you need to know, that EPSG:4283 is in degrees. See https://epsg.io/4283. You need to use another projection which uses meters as units. Otherwise you wont be able to buffer your points in meters. An alternative could be https://epsg.io/3112 or https://epsg.io/28355. Do some research to find a projection that fits your needs. (Could not find informations for EPSG:102171 doing a quick search. But if you know this one fits your needs, use it)


Secondly you need to know the difference between Project CRS and Layer CRS (which includes the CRS of tile services)

  1. Project CRS: This is the coordinate system of your map canvas: The projection your map will be displayed in. This works on the fly. The project CRS has nothing to do with the layers CRS. You can use layers in all different projections, but they will all be displayed in the projects CRS.

  2. Layers CRS: This is the coordinate system of your layer: The projection that all operations (like buffering) will be performed in. This is independent of your project CRS.

So you can add a XYZ tile, which is in EPSG:3857, to your project and also add a vector-point-layer, which is in EPSG:28355. The layers themselves will not be reprojected, but beeing displayed in the projects CRS which could for example be EPSG:4326. This happens on-the-fly. They will match in their displayed location.

You can not reproject data of a XYZ tile layer (unless you are the one hosting the service). And there is no need to do so. But you can change the projection that XYZ tile layer is beeing displayed in. This works via the project CRS.


Last and most importantly: Do NEVER USE "set CRS" in layer properties unless you know exactly what you are doing. This does not reproject your data/layer! If you want to reproject a layer, DO USE "export as..." and save it as a new file.

Related Question