Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23757 closed Bug (fixed)

Spatialite backend doesn't support 3d introspection

Reported by: Claude Paroz Owned by: nobody
Component: GIS Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Currently, Django crashes with an error like the following while introspecting Spatialite 3D field:

Traceback (most recent call last):
  File "...python2.7/tests/inspectdb/tests.py", line 182, in test_special_column_name_introspection
    call_command('inspectdb', stdout=out)
  File "...python2.7/django/core/management/__init__.py", line 115, in call_command
    return klass.execute(*args, **defaults)
  File "...python2.7/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "...python2.7/django/core/management/base.py", line 533, in handle
    return self.handle_noargs(**options)
  File "...python2.7/django/core/management/commands/inspectdb.py", line 27, in handle_noargs
    for line in self.handle_inspection(options):
  File "...python2.7/django/core/management/commands/inspectdb.py", line 100, in handle_inspection
    field_type, field_params, field_notes = self.get_field_type(connection, table_name, row)
  File "...python2.7/django/contrib/gis/management/commands/inspectdb.py", line 14, in get_field_type
    field_type, geo_params = connection.introspection.get_geometry_type(table_name, geo_col)
  File "...python2.7/django/contrib/gis/db/backends/spatialite/introspection.py", line 42, in get_geometry_type
    field_type = OGRGeomType(row[2]).django
  File "...python2.7/django/contrib/gis/gdal/geomtype.py", line 46, in __init__
    raise OGRException('Invalid OGR Integer Type: %d' % type_input)
OGRException: Invalid OGR Integer Type: 1001

Change History (7)

comment:2 by Claude Paroz, 10 years ago

Patch needs improvement: set

Tests are failing on the CI server, probably due to a different Spatialite version than on my system (4.0.0)...

comment:3 by Claude Paroz, 10 years ago

I *think* the remaining failures (unreproduceable on my system, even with Spatialite 3.0) are related to GEOS (see http://trac.osgeo.org/geos/ticket/292 which is fixed in GEOS 3.3). That is the GEOS version Spatialite is compiled with. In that case, we could simply skip those tests when GEOS < 3.3.

Extract of a traceback of one of those errors happening on the CI server (django.contrib.gis.tests.geo3d.tests.Geo3DTest.test_3d_hasz):

Traceback (most recent call last):
  File ".../python2.7/django/contrib/gis/tests/geo3d/tests.py", line 116, in test_3d_hasz
    self._load_interstate_data()
  File ".../python2.7/django/contrib/gis/tests/geo3d/tests.py", line 95, in _load_interstate_data
    Interstate3D.objects.create(name=name, line=line_3d)
...
File ".../python2.7/django/db/backends/sqlite3/base.py", line 507, in execute
    return Database.Cursor.execute(self, query, params)
IntegrityError: geo3d_interstate3d.line violates Geometry constraint [geom-type or SRID not allowed]

comment:4 by Tim Graham, 10 years ago

If that's the case, it sounds good to me. I verified the new tests pass on Ubuntu 14.04 and added a new build to Jenkins "django-master-trusty" to help us going forward. We need some workaround on 1.7 and 1.6 (like skipping tests) before creating similar builds for those versions, or we can simply skip the Spatial builds there.

comment:5 by Tim Graham, 10 years ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:6 by Claude Paroz <claude@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 65129aa:

Fixed #23757 -- Added 3D introspection support to Spatialite backend

Thanks Tim Graham for the review.

comment:7 by Tim Graham <timograham@…>, 10 years ago

In 02d78bb:

Fixed build failure introduced by refs #23757.

Note: See TracTickets for help on using tickets.
Back to Top