8

I have different layers with different CRS, I think therefore the layers don't match. But I don't know how to fix this. Here is what I did (QGIS 3.0.1 on Debian Buster).

I connected to OpenStreetMap Tile Server https://a.tile.openstreetmap.org/{z}/{x}/{y}.png to request XYZ Tiles. This is the first layer.

The tile server uses the CRS WGS 84, Pseudo Mercator Projection EPSG 3857.

Now, I tried to built my own map, by doing a quick query with QuickOSM. Key is building, querying Extent of the map canvas (coordinates are 300.000, 6.100.000, Scale is 1:60.000, which is in France, somewhere south of Paris).

This gives me three additional layers, all called OsmQuery, see image.

enter image description here

The additional layers use CRS WGS 84 EPSG:4326. If you look at the map, you see the buildings belonging to Chateau-Landon (south) near La Madeleine-sur-Loing (north). The destinations are about 7km apart.

My thinking is: "The error might result from different projections. However, 7km is a lot. I find it kind of strange that OpenStreetMap uses two different CRS." But I'm quite a newbie...

What can I do to get an exact match of all the layers?

My QGIS version is as follows:

enter image description here

7
  • Try setting your project CRS to the same as the tiles and enable On The Fly reprojection.
    – jcarlson
    Apr 7, 2018 at 13:12
  • Thanks, but I couldn't enable On The Fly reprojection in 3.0.1. I amended my original question regarding this fact. Maybe the feature disappeared in 3.0.1?
    – Markus
    Apr 7, 2018 at 13:49
  • 1
    "Disabling on the fly projection is no longer an option in QGIS 3.0" (issues.qgis.org/issues/11644)
    – Markus
    Apr 7, 2018 at 14:47
  • 2
    Same here, looks like a bug. If I save the buildings to geopackage and open the file in QGIS 2.18, buildings and background fit as expected.
    – AndreJ
    Apr 8, 2018 at 6:52
  • The problem went away for me after updating from QGIS 3.0.0 to 3.0.1 (on Windows 7 and Linux Mint with Ubuntugis dependencies).
    – AndreJ
    Apr 8, 2018 at 16:52

1 Answer 1

4

As suggested by AndreJ, I also did an apt-get upgrade, resulting in the following versions:

enter image description here

After the update, everything now works as expected. If I'm going to the same coordinates (300.000, 6.100.000) in EPSG 3857, scale 1:60.000 as before, I'm now landing at a slightly different location, south of Chalette-sur-Loing, approximately 25km more to the south as before. Hence the problem had something to do with a bug in EPSG 3857.

As the difference before between EPSG 3857 and EPSG:4326 was 7km, I think the bug wasn't confined to EPSG 3857 but maybe a general projection problem.

As the QGIS code revision remained the same, it was no QGIS problem. "Running against GDAL/OGR" changed from 2.2.3 to 2.2.4 and "Running against PROJ" changed from 5.0.0 to 5.0.1.

According to https://github.com/OSGeo/proj.4/issues/834, the problem might have been with PROJ.

Assuming QGIS uses cs2cs from PROJ to convert between CRS, the problem can be boiled down to the command line as follows (everything should be written in one line):

echo 300000 6100000 | cs2cs 
+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs 
+to 
+proj=longlat +datum=WGS84 +no_defs 
-f %.12f

The correct version of PROJ should result in:

2.694945852359  47.958779800526 0.000000000000

But I don't mind anymore - everything works now as it is supposed to be now. Great software!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.