[Qgis-user] Help with scales in print layouts for geographic CRS

Jorge Gustavo Rocha jgr at geomaster.pt
Wed Apr 6 10:12:56 PDT 2022


Hi,

Thank you all for the comments.

As far as I can see from my tests, the behavior is not related with the 
CRS in use. I've used more than one meter based projection to make sure 
the areas were fine. I use the advanced digitizing tools to create 
segments with the exact distance. Using projected CRS, the layouts are 
always fine.

The problem is related to the map area calculated for a giving scale, in 
the composer, when a lat/long coordinate system is in use.

If I make a very simple calculation of the area to render at a giving 
scale, my calculations work fine.

The width does not depend on the latitude, and should be:

layout_width_mm * scale / 1000.0

The height depends on the latitude. To compute it, I use the cosine of 
the latitude:

cosine = cos( center_latitude * PI / 180 );

layout_height_mm * scale / 1000.0 / cosine;

Based on this simple math, after converting these distances to lat/log, 
I can compute the "correct" ( ie expected) extend of the map in the 
layout. If I setup this extent manually, it works fine.

But the extent calculated by QGIS is different. I'll have to check the 
code to see why the logic if different from this one. Probably I am 
simplifying the calculations too much.

I'll return back after reading the code.

Regards,

Jorge Gustavo

On 06/04/22 15:10, Greg Troxel via Qgis-user wrote:
> Patrick Dunford via Qgis-user <qgis-user at lists.osgeo.org> writes:
>
>> On 6/04/22 11:34, Greg Troxel via Qgis-user wrote:
>>> Jorge Gustavo Rocha via Qgis-user <qgis-user at lists.osgeo.org> writes:
>>>
>>> 2) Using a geographic CRS, the same 150mm x 150mm map, at the same
>>>> 1:10000 scale, the area is bigger then the 1500m polygon. The result
>>>> is attached https://nextcloud.geomaster.pt/index.php/s/H2eAytsPANyxn6Y
>>>>
>>>> On both layouts the scale bar widget is working properly. The
>>>> distances (and areas) are properly calculated in QGIS interface. I
>>>> have set the GRS 1980 ellipsoid for distance and area calculations.
>>> What does it mean to use a geographic CRS for a print layout?  Do you
>>> really expect longitude on the x axis and latitude on the y axis?  The
>>> value of meters/degree is different for x and y, unless you are at or
>>> near the equator.  (Living at 42N-ish, I'm very aware of this.)
>> This may be the case for projections like EPSG:3857 that are based on
>> a spherical projection of the Earth but is it the case for all
>> projections?
> By "geographic CRS", I interpet that to mean one that is latitude and
> longitude.  That is not really a "projection".
>
> Yes, EPSG:3857 has an incorrect spherical assumption, and I'd have to
> calculate, but I would not expect massive scale distortion, where
> massive is casually visually apparent.
>
> Perhaps Jorge can be precise about which CRS codes are in use.
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


More information about the Qgis-user mailing list