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.09k stars 2.93k forks source link

North Arrow in Print Layout disappears when resize mode set to 'Zoom and Resize Frame' and map frame has rotation #37460

Open gvellut opened 4 years ago

gvellut commented 4 years ago

When I add a North Arrow in a Print Layout and set its resize mode to 'Zoom and Resize Frame' and its linked map frame has a rotation, then if I save the QGZ, exits QGIS and reopen the QGZ, the north arrow no longer displays in the layout. The object is still listed in the items but it does not display on the page (where it used to be). When I look at the position of the north arrow, it is set with 999999.0 in the values :

Screenshot 2020-06-28 at 20 42 17

Here is a saved QGZ (inside a zip) where I already did the steps described below (1 to 6).

ghbr.qgz.zip

How to Reproduce

  1. Create a new QGIS document (leave it empty)
  2. Create a new print layout
  3. Add a map then a north arrow
  4. Add some rotation to the map
  5. Set the resize mode of the arrow to 'Zoom and Resize Frame'
  6. Save and exit
  7. Reopen the QGZ and the layout.
  8. Where is the north arrow??

QGIS and OS versions

I am using QGIS 3.14 on macOS 10.14.

QGIS version 3.14.0-Pi QGIS code revision 9f7028fd23
Compiled against Qt 5.12.3 Running against Qt 5.12.3
Compiled against GDAL/OGR 2.4.1 Running against GDAL/OGR 2.4.1
Compiled against GEOS 3.7.2-CAPI-1.11.2 Running against GEOS 3.7.2-CAPI-1.11.2 b55d2125
Compiled against SQLite 3.28.0 Running against SQLite 3.28.0
PostgreSQL Client Version 11.3 SpatiaLite Version 4.3.0a
QWT Version 6.1.4 QScintilla2 Version 2.11.1
Compiled against PROJ 5.2.0 Running against PROJ Rel. 5.2.0, September 15th, 2018
OS Version macOS Mojave (10.14)
Active python plugins FreehandRasterGeoreferencer; firstaid; profiletool; quick_map_services; QGIS3-getWKT; QuickWKT; qgis-maptiler-plugin; plugin_reloader; valuetool; processing; db_manager; MetaSearch; CustomToolBar
benhur07b commented 4 years ago

Confirmed on Linux (Ubuntu 20.04) that the North Arrow moves / disappears from the print canvas when 'Zoom and Resize Frame' is selected together with 'Sync with Map'.

The issue does not seem to occur for other Resize Modes. Also, if 'Sync with Map' is not selected and 'Image Rotation' is provided manually, it looks like this issue does not occur.

techdude1996 commented 4 years ago

Also confirmed on Windows 10.

A current work-around is to use the marker.

fiddlersfan commented 3 years ago

Also confirmed on Windows 10 in the last LTR Version 3.16.5.

The issue occurs in both .qgs and .qgz project files. The cause is probably that nan is returned and stored in the projectfile:

<LayoutItem uuid="{435ed10e-d0f8-436b-abc5-bcfc130a9981}" frameJoinStyle="miter" positionLock="false" outlineWidthM="0.3,mm" zValue="1" itemRotation="0" svgBorderWidth="0" referencePoint="0" positionOnPage="nan,nan,mm" file="wind_roses/WindRose_01.svg" groupUuid="" northMode="0" type="65640" frame="false" excludeFromExports="0" svgBorderColor="255,255,255,255" visibility="1" size="nan,nan,mm" opacity="1" pictureWidth="nan" anchorPoint="0" mapUuid="{5db86f59-fd5f-47d6-a544-9fb0048f365b}" templateUuid="{435ed10e-d0f8-436b-abc5-bcfc130a9981}" northOffset="0" id="Nordpfeil" mode="0" position="nan,nan,mm" svgFillColor="0,0,0,255" background="false" blendMode="0" resizeMode="3" pictureHeight="nan" pictureRotation="10">

(Extract from the project file (xml) after saving)

Pedro-Murteira commented 2 years ago

Still valid on QGIS 3.22.3. (Windows 10)

CharlesGag commented 2 years ago

In my report, I use a simple arrow to indicate the direction a picture was taken (by reading the EXIF tag - GPSDirection in a plain table where I store the images). This works great, but each time I save and exit, the arrow indeed moves away from the center. It's happening with a simple arrow, or a SVG, which makes me think it's somehow relation only to the "rotation" option ? Hope that helps. Thanks

rotation_bug rotation_bug2

esnyder-rve commented 2 years ago

@CharlesGag the current workaround is to use a Marker layout item instead of North Arrow layout item. The marker can be rotated via a data defined override in the rotation tab.

CharlesGag commented 2 years ago

@esnyder-rve You are right it seems to be working fine. I tried with an North Arrow AND with a regular arrow (shape) and I had the same inconclusive result with both so I thought the problem was with the rotation tab. I assumed it would do the same with the marker but I was wrong. Thanks for your help

antoniolocandro commented 1 year ago

Still happening with 3.30.0-'s-Hertogenbosch, also you are not able to select the item except via the Items panel so you can't drag it around