[QGIS-Developer] Disappearing -180 / 180 longitude grid lines on certain zoom levels

Andreas Neumann a.neumann at carto.net
Wed Aug 29 12:50:25 PDT 2018

Hi Even,

Thank you very much for the detailed analysis of the spatial filter 
issue we have here, that causes the disappearing grid lines.

Would you be interested to work on fixing this issue on our bug fixing 
program? This problem annoyed me for quite some time. And it appears on 
different world projections.



Am 28.08.2018 um 22:19 schrieb Even Rouault:
> Yes, seems restricted to reprojection cases
> This seems to be an issue with the spatial filter issued to OGR
> At the zooms where the lines disappear, there are requests like:
> Thread 23 "Thread (pooled)" hit Breakpoint 2, OGR_L_SetSpatialFilterRect
> (hLayer=0x7f81180c90a0, dfMinX=-179.79163612932865,
> dfMinY=-69.446164378986353, dfMaxX=179.90530755284408,
> dfMaxY=78.959077253477474) at ogrlayer.cpp:1223
> At the zooms where that work (even when zoomed in), there are like:
> Thread 29 "Thread (pooled)" hit Breakpoint 2, OGR_L_SetSpatialFilterRect
> (hLayer=0x7f81180c90a0, dfMinX=-180, dfMinY=-90, dfMaxX=180, dfMaxY=90) at
> ogrlayer.cpp:1223
> I haven't looked at the QGIS code that computes this bounding box, but from my
> experience with gdalwarp which has similar challenges, it is tricky to compute
> a source bounding box from a target bounding box, because sometimes the
> coordinates in the target bounding box do not correspond to a physical point
> on Eath, and hence inverse projection fails. So you have to resort to a grid
> sampling approach, but that makes you miss the exact boundaries. So probably
> that a band-aid fix would be to add some ad-hoc logic, like "if the source SRS
> is long/lat, and the computed extent is almost worldwide, then extend it to
> full worlwide (or do not emit a spatial filter at all)"
> Even
>> With EPSG:4326 it does not seem to happen, but I tried EPSG:3857 and the
>> -180,180 grid lines do appear and disappear at different zoom levels. I
>> also confirm this with the Robinson projection with the addition that the
>> -90, 90 degree latitude lines also appear and disappear.
>> Calvin
>> On Tue, Aug 28, 2018 at 3:31 PM, Andreas Neumann <a.neumann at carto.net>
>> wrote:
>>> Hi again,
>>> For some time already I noticed that, depending on the zoom level, the
>>> -180 / 180 degree grid lines appear / disappear in QGIS. This is unrelated
>>> to the EqualEarth projection just discussed and also appears on other
>>> world
>>> projections, like the Robinson projection.
>>> Here is the testfile I used with world (countries) and gridlines:
>>> http://www.carto.net/neumann/temp/gridlines.gpkg
>>> Can you reproduce this behaviour?
>>> Any idea why this happens and how this could be fixed?
>>> Thanks,
>>> Andreas
>>> _______________________________________________
>>> QGIS-Developer mailing list
>>> QGIS-Developer at lists.osgeo.org
>>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

More information about the QGIS-Developer mailing list