<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Hi,<div>Your calculations are based on a sphere.  The different crs use a geoids. It would help if you could say what crs you are using and the differences between what you get and what you expect.<br><br><div dir="ltr">Nicolas Cadieux<div><a href="https://gitlab.com/njacadieux">https://gitlab.com/njacadieux</a></div></div><div dir="ltr"><br><blockquote type="cite">Le 6 avr. 2022 à 13:13, Jorge Gustavo Rocha via Qgis-user <qgis-user@lists.osgeo.org> a écrit :<br><br></blockquote></div><blockquote type="cite"><div dir="ltr"><span>Hi,</span><br><span></span><br><span>Thank you all for the comments.</span><br><span></span><br><span>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.</span><br><span></span><br><span>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.</span><br><span></span><br><span>If I make a very simple calculation of the area to render at a giving scale, my calculations work fine.</span><br><span></span><br><span>The width does not depend on the latitude, and should be:</span><br><span></span><br><span>layout_width_mm * scale / 1000.0</span><br><span></span><br><span>The height depends on the latitude. To compute it, I use the cosine of the latitude:</span><br><span></span><br><span>cosine = cos( center_latitude * PI / 180 );</span><br><span></span><br><span>layout_height_mm * scale / 1000.0 / cosine;</span><br><span></span><br><span>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.</span><br><span></span><br><span>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.</span><br><span></span><br><span>I'll return back after reading the code.</span><br><span></span><br><span>Regards,</span><br><span></span><br><span>Jorge Gustavo</span><br><span></span><br><span>On 06/04/22 15:10, Greg Troxel via Qgis-user wrote:</span><br><blockquote type="cite"><span>Patrick Dunford via Qgis-user <qgis-user@lists.osgeo.org> writes:</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><blockquote type="cite"><span>On 6/04/22 11:34, Greg Troxel via Qgis-user wrote:</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>Jorge Gustavo Rocha via Qgis-user <qgis-user@lists.osgeo.org> writes:</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>2) Using a geographic CRS, the same 150mm x 150mm map, at the same</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>1:10000 scale, the area is bigger then the 1500m polygon. The result</span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>is attached https://nextcloud.geomaster.pt/index.php/s/H2eAytsPANyxn6Y</span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span></span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>On both layouts the scale bar widget is working properly. The</span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>distances (and areas) are properly calculated in QGIS interface. I</span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>have set the GRS 1980 ellipsoid for distance and area calculations.</span><br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>What does it mean to use a geographic CRS for a print layout?  Do you</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>really expect longitude on the x axis and latitude on the y axis?  The</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>value of meters/degree is different for x and y, unless you are at or</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><span>near the equator.  (Living at 42N-ish, I'm very aware of this.)</span><br></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>This may be the case for projections like EPSG:3857 that are based on</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>a spherical projection of the Earth but is it the case for all</span><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><span>projections?</span><br></blockquote></blockquote><blockquote type="cite"><span>By "geographic CRS", I interpet that to mean one that is latitude and</span><br></blockquote><blockquote type="cite"><span>longitude.  That is not really a "projection".</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Yes, EPSG:3857 has an incorrect spherical assumption, and I'd have to</span><br></blockquote><blockquote type="cite"><span>calculate, but I would not expect massive scale distortion, where</span><br></blockquote><blockquote type="cite"><span>massive is casually visually apparent.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>Perhaps Jorge can be precise about which CRS codes are in use.</span><br></blockquote><blockquote type="cite"><span></span><br></blockquote><blockquote type="cite"><span>_______________________________________________</span><br></blockquote><blockquote type="cite"><span>Qgis-user mailing list</span><br></blockquote><blockquote type="cite"><span>Qgis-user@lists.osgeo.org</span><br></blockquote><blockquote type="cite"><span>List info: https://lists.osgeo.org/mailman/listinfo/qgis-user</span><br></blockquote><blockquote type="cite"><span>Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user</span><br></blockquote><span>_______________________________________________</span><br><span>Qgis-user mailing list</span><br><span>Qgis-user@lists.osgeo.org</span><br><span>List info: https://lists.osgeo.org/mailman/listinfo/qgis-user</span><br><span>Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user</span><br></div></blockquote></div></body></html>