On production server I receive the attached error, not emerging on the development server. Both environments are identical (same Django 1.6 and Python 2.7 versions, using virtualenvs same RDBMS version - a postgresql 9.1 server, running locally with a reasonably similar configuration than on production).
The offending code, I suppose, is in views.py
:
from djgeojson.views import GeoJSONLayerView
class FilteredMapLayer(GeoJSONLayerView):
def get_queryset(self):
qs = super(FilteredMapLayer, self).get_queryset()
bbox_data = self.request.GET.get('bbox', None)
if bbox_data is not None:
bbox_data = ( x for x in map(float, bbox_data.split(',')))
bbox = Polygon.from_bbox(bbox_data)
features = qs.filter(geom__bboverlaps=bbox)
else:
features = qs
return features
since this is the urlpattern
definition that, when requested, triggers the error
url(r'^data.geojson$', FilteredMapLayer.as_view(model=MyModelName, precision = 2, simplify = 0.5), name='myurl'),
here is the complete traceback, that does not provide me any info on where I did wrong....
Traceback (most recent call last):
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 114, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/views/generic/base.py", line 69, in view
return self.dispatch(request, *args, **kwargs)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/utils/decorators.py", line 29, in _wrapper
return bound_func(*args, **kwargs)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/utils/decorators.py", line 99, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/utils/decorators.py", line 25, in bound_func
return func(self, *args2, **kwargs2)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/views.py", line 51, in dispatch
return super(GeoJSONLayerView, self).dispatch(*args, **kwargs)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/views/generic/base.py", line 87, in dispatch
return handler(request, *args, **kwargs)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/views/generic/list.py", line 153, in get
return self.render_to_response(context)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/views.py", line 41, in render_to_response
**options)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/serializers.py", line 335, in serialize
self.serialize_queryset(queryset)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/serializers.py", line 277, in serialize_queryset
self.handle_field(obj, self.geometry_field)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/serializers.py", line 177, in handle_field
geometry = self._handle_geom(GEOSGeometry(value))
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/serializers.py", line 159, in _handle_geom
geometry.transform(self.srid)
File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/contrib/gis/geos/geometry.py", line 510, in transform
raise GEOSException("Calling transform() with no SRID set is not supported")
.... since if I check the features stored in the model, they all have a SRID defined (4326) and I'm not trying to call any transformation - I suppose - since I'm rendering the view using the same SRID. And, I repeat myself here, the same request on dev server works seamlessly.
What I've tried so far:
- recreated the DB from scratch, reloaded all the data. Using Django admin I can see/edit the features stored
- checked all software dependences and updated the code from trunk of https://github.com/makinacorpus/django-geojson
- checked model definitions: all have
geom = models.MultiPolygonField(srid=4326)
fields
- searched Google and SO for similar issues without any luck
I have no more ideas. Any suggestion is welcome!
See Question&Answers more detail:
os