Closed AlisterH closed 3 years ago
It seems to me that the destination SRS doesn't need to be changed - I can just comment out this line in qgis_map_helpers.py:
iface.mapCanvas().setDestinationCrs(TileLayer.CRS_3857)
Can't reproduce (understand) it here. Here is my scenario:
can you be more specific?
I'm using QGIS 3.18.
I have just tested with QGIS 3.16 and 3.18.
Unfortunately the Windows screen recorder won't record context menus and dialogs, so I'm not sure it's worth it, but here is a recording showing the coordinate display changing. The empty memory layer is in EPSG:2193 I load the Google satellite layer then use "set project CRS from layer" to change to EPSG:2193 and back to EPSG:2105. https://user-images.githubusercontent.com/714600/119962138-d9b24400-bffa-11eb-8de2-13da02bdd199.mp4
please check this and may be try to replicate it
http://m-d.me/img/ss/zQz4vpqGC4.gif
does it produce correct behavior for you?
I see - the problem only occurs when I load the layer using the menu (Web>Quickmapservices). There is no problem if I use the "Search QMS" panel to load the layer.
that's it then, marking it as a bug
the behavior from the catalog should be the same as behavior from the QMS search
PS: for the future reference, we'll be retiring catalog gradually in favor of search panel
PS: for the future reference, we'll be retiring catalog gradually in favor of search panel
That's a shame because it's nice to not have to use a panel.
no difference, same number of clicks
ok, I was to quick to call it a bug.
It's just a option that apparently is turned on for you:
If you don't like your CRS to change to 3857 on adding a basemap - just turn it off. It should fix everything.
We'll:
Fixed in 0.19.19
Sorry, there is still a bug (or arguably two), it is just different now. If "Enable EPSG:3857 (OTF) on adding TMS:" setting is disabled, both the menu and the panel work as expected. But if the setting is enabled:
did you update to latest version of QMS plugin (0.19.17)?
just tested with this option ON and both scenarios change project CRS to 3857 like expected
0.19.19, and I have just double-checked that the behaviour is as per my last comment.
Also, I checked that after adding the QMS layer using the search panel, the problem isn't just that the "current CRS" button displays the wrong CRS. In some sense QGIS really believes that it is still using the original CRS, e.g. if I use the nominatum location filter to find an address, I get taken to completely the wrong place (the displayed coordinates would be correct for the original CRS).
Testing with a clean QGIS profile the behaviour is the same as I have described. Interestingly the "Search QMS" panel remembered the "Last used" services that were used in the original profile.
Ok, I'm confused. Please try to be very specific and omit any side information such as nominatim usage etc. Stick to the bare scenario.
I'm doing this:
Enable 3857 option in QMS is on.
does this work for you?
That only works if I start with a new empty project and with QGIS itself configured to change the CRS to match the first layer added (Scenario B below). Scenario C below demonstrates the problem.
Scenario A: "Settings>Options>CRS for Projects>When a new project is created" is set to "Use CRS from first layer added", and "Enable EPSG:3857 (OTF) on adding TMS" is OFF. I follow your steps 1 to 3 and the CRS is changed to EPSG:3857, presumably because of the QGIS setting. This behaviour seems correct.
Scenario B: "Settings>Options>CRS for Projects>When a new project is created" is set to "Use CRS from first layer added", and "Enable EPSG:3857 (OTF) on adding TMS" is ON. I follow your steps 1 to 3 and the CRS is changed to EPSG:3857. This behaviour seems correct.
Scenario C: "Settings>Options>CRS for Projects>When a new project is created" is set to "Use a default CRS", and "Enable EPSG:3857 (OTF) on adding TMS" is ON. I follow your steps 1 to 3 and the map and coordinates display in EPSG:3857 (correct behaviour), but the "current CRS" button still says the CRS is EPSG:4326 (incorrect behaviour).
Scenario D: "Settings>Options>CRS for Projects>When a new project is created" is set to "Use a default CRS", and "Enable EPSG:3857 (OTF) on adding TMS" is OFF. I follow your steps 1 to 3 and the map and coordinates display in EPSG:4326 (correct behaviour).
Sorry, fixed my description of scenario D.
thanks so much for working on that, now it is clear
@514ckw4r3 lets work on Scenario C below, I believe we should override QGIS setting in this case and boil down Scenario C to Scenario B
@AlisterH, the setting "CMS for Projects->When a new project is created" only affects new projects. You need to create a new project and then the Project CRS will be set correctly.
? That setting works fine, I don't know why you think I have a problem with it. The problem is with the QMS setting.
I believe we should override QGIS setting in this case and boil down Scenario C to Scenario B
Note that the issue is actually unrelated to the initial setting of a project CRS - it is just that your settings for that were masking the problem in your testing. The QMS layer would usually not be the first layer added, and the QMS setting should work regardless of whether or not it is.
Personally I don't understand why QMS needs this setting - people don't normally seem to need the CRS changed every time a new layer is added, so I'm not sure why they would need that when using QMS. I imagine your code would be a lot simpler without this option...
good question, we've been discussing to remove it altogether too
the current plan is to first fix Scenario C to make behavior consistent and then rethink it completely may be removing settings altogether
Scenario C fixed in version 0.19.20. Now the 'Enable EPSG:3857 (OTF) on adding TMS' option also changes the project CRS. The fix will be available in the next release.
OK, that works properly when adding from the search panel But please be aware that it doesn't attempt to enable EPSG:3857 when adding from the menu.
behavior should be the same
turns out that catalog geoservices don't even declare CRS, so adding from catalog behavior is OK, since 3857 option should work only for TMS with 3857 declared explicitly
once declared, all works as expected https://github.com/nextgis/quickmapservices/blob/master/src/data_sources/osm_mapnik/metadata.ini#L23