qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.42k stars 2.98k forks source link

Wrong scalebar with custom CRS #46060

Open alliejo1015 opened 2 years ago

alliejo1015 commented 2 years ago

What is the bug or the crash?

All of the scale bars on my print layouts have disappeared, even though they show up in the item menu. I try drawing new scale bars and nothing shows up.

Steps to reproduce the issue

In Layouts, trying to 'add a scale bar' to the map doesn't work or show up.

Versions

QGIS version 3.22.0-Białowieża QGIS code revision d9022691f1 Qt version 5.15.2 Python version 3.9.5 GDAL/OGR version 3.4.0 PROJ version 8.2.0 EPSG Registry database version v10.038 (2021-10-21) GEOS version 3.10.0-CAPI-1.16.0 SQLite version 3.35.2 PDAL version 2.3.0 PostgreSQL client version 13.0 SpatiaLite version 5.0.1 QWT version 6.1.3 QScintilla2 version 2.11.5 OS version Windows 10 Version 2009

Active Python plugins profiletool 4.2.1 quick_map_services 0.19.26 db_manager 0.1.20 grassprovider 2.12.99 MetaSearch 0.3.5 processing 2.12.99 sagaprovider 2.12.99

Supported QGIS version

New profile

Additional context

No response

gioman commented 2 years ago

In Layouts, trying to 'add a scale bar' to the map doesn't work or show up.

@alliejo1015 can't confirm here, on QGIS 3.22.0 and Win 10. Have you tried on a new QGIS profile?

alliejo1015 commented 2 years ago

I just tried that and I get the same result :/ However, if I export the image I get two lines and a 0 on the map even though a month or so ago it was perfect. Haven't changed any of the settings on the scale bar either.

gioman commented 2 years ago

I just tried that and I get the same result :/ However, if I export the image I get two lines and a 0 on the map even though a month or so ago it was perfect. Haven't changed any of the settings on the scale bar either.

@alliejo1015 attach a sample project with data and a layout.

alliejo1015 commented 2 years ago

Sweden_overview_share.zip lmk if that doesn't work - never tried to share a project before.

gioman commented 2 years ago

lmk if that doesn't work - never tried to share a project before.

@alliejo1015 you missed the data, but it doesn't matter the project is enough to understand that the issue arises from the custom CRS of the project. If you use a standard one, like 32634 then the scale is ok.

alliejo1015 commented 2 years ago

ah thanks! but now my DEM doesn't line up with the shapefile and is in the wrong place. image am I missing something else here?

gioman commented 2 years ago

am I missing something else here?

I can't say the project you attached has no data. But it is likely that some of your data has a missing CRS or wrong CRS.

alliejo1015 commented 2 years ago

I changed the overall project to the projection you suggested and that seemed to work! so strange. thanks for your help!

mir123 commented 1 year ago

I'm getting a similar bug with a custom CRS. Scale bar shows "NaN". But these steps sidestep the issue:

hjhilden commented 11 hours ago

With a custom Chamberlin Trimetric projection the trick mentioned by @mir123 did not work +proj=chamb +lat_1=22 +lon_1=0 +lat_2=22 +lon_2=45 +lat_3=-22 +lon_3=22.5 +datum=WGS84 +type=crs Tested with QGIS 3.34.10-Prizren.