Calling transform() with no SRID set is not supported

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

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)
            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/", 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/", 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/", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/utils/", line 29, in _wrapper
    return bound_func(*args, **kwargs)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/utils/", line 99, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/utils/", line 25, in bound_func
    return func(self, *args2, **kwargs2)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/", 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/", line 87, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/views/generic/", line 153, in get
    return self.render_to_response(context)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/", line 41, in render_to_response
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/", line 335, in serialize
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/", line 277, in serialize_queryset
    self.handle_field(obj, self.geometry_field)
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/", line 177, in handle_field
    geometry = self._handle_geom(GEOSGeometry(value))
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/djgeojson/", line 159, in _handle_geom
  File "/home/m2user/webapps/enea/local/lib/python2.7/site-packages/django/contrib/gis/geos/", 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
  • 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!


I was able to solve my issue by uninstalling and then re-installing all the libraries (as ubuntu packages), the python interpreter, all the code, by re-generating the database (including reinstalling postgis) and then by completely restart nginx (and thus gunicorn). No libraries were updated, however, so I still do not understand what really happened.

Need Your Help

Media Element.js - Change video poster image

jquery mediaelement.js

I have integrated MediaElement.js video player into my MVC 4 application.In that view, I have a button and in button click I want to change the video source and poster image. I have found prperties...

Unable to add Tomcat server instance in Netbeans 6.9 (touch: cannot touch `/usr/share/tomcat6/logs/catalina.out')

java tomcat netbeans

I'm learning JSPs and servlets and I wanna use Netbeans. I've been unable to set Tomcat as the server instance.