#21907 closed Bug (fixed)
GeoQueryset.transform() broken in Spatialite >= 4
Reported by: | Akis Kesoglou | Owned by: | Claude Paroz |
---|---|---|---|
Component: | GIS | Version: | dev |
Severity: | Normal | Keywords: | geodjango, spatialite, geoqueryset, transform, srs, google, mercator, 900913, |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hello, changeset #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 "<virtualenv>/src/django/django/core/handlers/base.py" in get_response 113. response = wrapped_callback(request, *callback_args, **callback_kwargs) File "<project>/views.py" in object_list 121. .distance(location.point, field_name='current_location__point')) File "<virtualenv>/src/django/django/contrib/gis/db/models/query.py" in distance 104. return self._distance_attribute('distance', geom, **kwargs) File "<virtualenv>/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 "<virtualenv>/src/django/django/contrib/gis/db/models/fields.py" in get_srid_info 40. spheroid = SpatialRefSys.get_spheroid(sr.wkt) File "<virtualenv>/src/django/django/contrib/gis/db/backends/base.py" in get_spheroid 323. srs = gdal.SpatialReference(wkt) File "<virtualenv>/src/django/django/contrib/gis/gdal/srs.py" in __init__ 94. self.import_user_input(srs_input) File "<virtualenv>/src/django/django/contrib/gis/gdal/srs.py" in import_user_input 295. capi.from_user_input(self.ptr, force_bytes(user_input)) File "<virtualenv>/src/django/django/contrib/gis/gdal/prototypes/errcheck.py" in check_errcode 117. check_err(result) File "<virtualenv>/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:
- Add a check
or not self.srtext
at spatialite/models.py:61 - Fix django.contrib.gis.utils.add_srs_entry by checking the connection version, similar to how it's done models.py above.
Change History (3)
comment:1 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:3 by , 11 years ago
Note: the test was added in the previous commit: [fabc678f930431fd6e502fe7930ee772eff96898]
Note:
See TracTickets
for help on using tickets.
In 9c8d62a06fc83efa019f23b6b87b39a82c95ab97: