id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 21907,GeoQueryset.transform() broken in Spatialite >= 4,Akis Kesoglou,Claude Paroz,"Hello, changeset [https://code.djangoproject.com/changeset/362dd68fb20be195462af22448416c9895ce7df7 #362dd68fb20] broke adding Google's 900913 SRS entry in spatialite. {{{django.contrib.gis.utils.add_srs_entry}}} leaves the new {{{srtext}}} field empty, resulting in {{{GeoQueryset.transform()}}} raising an OGRException exception. Here's the traceback: {{{ Traceback: File ""/src/django/django/core/handlers/base.py"" in get_response 113. response = wrapped_callback(request, *callback_args, **callback_kwargs) File ""/views.py"" in object_list 121. .distance(location.point, field_name='current_location__point')) File ""/src/django/django/contrib/gis/db/models/query.py"" in distance 104. return self._distance_attribute('distance', geom, **kwargs) File ""/src/django/django/contrib/gis/db/models/query.py"" in _distance_attribute 648. u, unit_name, s = get_srid_info(self.query.transformed_srid, connection) File ""/src/django/django/contrib/gis/db/models/fields.py"" in get_srid_info 40. spheroid = SpatialRefSys.get_spheroid(sr.wkt) File ""/src/django/django/contrib/gis/db/backends/base.py"" in get_spheroid 323. srs = gdal.SpatialReference(wkt) File ""/src/django/django/contrib/gis/gdal/srs.py"" in __init__ 94. self.import_user_input(srs_input) File ""/src/django/django/contrib/gis/gdal/srs.py"" in import_user_input 295. capi.from_user_input(self.ptr, force_bytes(user_input)) File ""/src/django/django/contrib/gis/gdal/prototypes/errcheck.py"" in check_errcode 117. check_err(result) File ""/src/django/django/contrib/gis/gdal/error.py"" in check_err 53. raise e(msg) Exception Type: OGRException at /url Exception Value: Corrupt data. }}} Poking inside django.contrib.gis, I figure there are 2 ways this can be resolved: 1. Add a check {{{or not self.srtext}}} at [https://github.com/django/django/blob/master/django/contrib/gis/db/backends/spatialite/models.py#L61 spatialite/models.py:61] 2. Fix [https://github.com/django/django/blob/master/django/contrib/gis/utils/srs.py#L67 django.contrib.gis.utils.add_srs_entry] by checking the connection version, similar to how it's done models.py above.",Bug,closed,GIS,dev,Normal,fixed,"geodjango, spatialite, geoqueryset, transform, srs, google, mercator, 900913,",,Accepted,0,0,0,0,0,0