Bug report #19746
Disappearing -180 / 180 longitude grid lines on certain zoom levels
|Affected QGIS version:||3.3(master)||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||27571|
Depending on the zoom level, the -180 / 180 degree grid lines appear / disappear in QGIS.
This is not depending on a certain projection, but seems to be a spatial filter accuracy issues.
Quote from Even Rouault:
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
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
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)"
Attached is a Geopackage file with grid lines for testing.
#4 Updated by Johannes Kroeger almost 3 years ago
Another easy test case:
- Load ne_110m_coastline and ne_110m_graticules_20.
- Set projection to EPSG:3995 or EPSG:3031 ((ant)arctic stereographic)
- Zoom to ne_110m_coastline
- Rotate the map canvas
- The antimeridian as well as some high latitudes will disappear every now and then (eg at 20° rotation).