Bug report #11999

SpatiaLite layer not displayed and reports wrong extent

Added by Alexander Bruy over 9 years ago. Updated over 9 years ago.

Status:Closed
Priority:High
Assignee:Sandro Furieri
Category:Data Provider/SpatiaLite
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:20203

Description

When adding layers from SpatiaLite database to QGIS they not dispalyed, in QGIS statusbar I see wrong coordinates and scale. Zoom to layer extent and other naviagtion tools also don't work. Tried to get layer extent using Python console and got completely wrong values:

>>> l = iface.mapCanvas().currentLayer()
>>> l.extent().toString()
u'-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0000000000000000,-179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368.0000000000000000 : 1023822.9999672472476959,208209.0000113248825073'

If project CRS changed from layer CRS (EPSG:2263) to WGS84 I can zoom to layer.
Same layer, loaded from shapefile dispalyed and worked fine.

Tested with master 2.2, 2.4 and 2.6.1. SpatiaLite 4.0.0, Proj 4.8, GEOS 3.3.8 and GDAL 1.11.0

Sample database with one layer attached.

db.7z (4.76 MB) Alexander Bruy, 2015-01-18 02:29 AM

History

#1 Updated by Alexander Bruy over 9 years ago

  • Subject changed from SpatiaLine layer not displayed and reports wrong extent to SpatiaLite layer not displayed and reports wrong extent

#2 Updated by Sandro Furieri over 9 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

there are several rows in the sample that are completely bogus :-D

SELECT Count(*) Min(MbrMinX(geom)), Min(MbrMinY(geom)), Max(MbrMaxX(geom)), Max(MbrMaxY(geom))
FROM trees
WHERE MbrMinX(geom) > 0.0;
----------------------------
149568 972921.000048 147696.999955 1023822.999967 208209.000011

so there are about 150,000 "good" geometries.

SELECT Count(*) FROM trees
WHERE MbrMinX(geom) <= 0.0;
----------------------------
946

anyway there are about one thousand crazy geometries declaring "impossible"
coordinate values as confirmed by this final query:

SELECT ST_X(geom), ST_Y(geom)
FROM trees
WHERE MbrMinX(geom) <= 0.0;
-------------------------------
for all 946 "crazy geoms" the same absurd and incredibly huge negative
value is always reported for both X and Y
please note: this value apparently seems to exactly match:
0.0 - DBL_MAX (1.7976931348623157E+308)

final counter-check:

DELETE FROM trees
WHERE ST_X(geom) <= 0.0;

after deleting all "crazy" rows this layer will immediately start to
work nicely

bye Sandro

Also available in: Atom PDF