Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9694 closed (fixed)

Geographic Admin raises 'Invalid SRS type "wkt"' TypeError on Ubuntu 8.10 (Apache 2.2.9)

Reported by: jbronn Owned by: jbronn
Component: GIS Version: master
Severity: Keywords: gis apache ubuntu
Cc: adamfast@…, dane.springmeyer@… Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by jbronn)

When using the geographic admin on the simple world application, the following error is raised when using Apache 2.2.9 on Ubuntu 8.10 with both mod_python (3.3.1) and mod_wsgi (2.3):

Original Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/template/debug.py", line 71, in render_node
    result = node.render(context)
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/template/debug.py", line 87, in render
    output = force_unicode(self.filter_expression.resolve(context))
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/utils/encoding.py", line 49, in force_unicode
    s = unicode(s)
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/forms/forms.py", line 333, in __unicode__
    return self.as_widget()
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/forms/forms.py", line 365, in as_widget
    return widget.render(name, data, attrs=attrs)
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/gis/admin/widgets.py", line 43, in render
    value.transform(srid)
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/gis/geos/base.py", line 460, in transform
    self._post_init(g.srid)
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/gis/gdal/geometries.py", line 258, in get_srid
    if self.srs: return self.srs.srid
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/gis/gdal/geometries.py", line 239, in get_srs
    return SpatialReference(clone_srs(srs_ptr))
  File "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/gis/gdal/srs.py", line 91, in __init__
    raise TypeError('Invalid SRS type "%s"' % srs_type)
TypeError: Invalid SRS type "wkt"

However, this does not happen on Ubuntu 8.04 (Apache 2.2.8 + same version of mod_python). The attached patch fixes the exception. Basically, instead of doing the transform ops on the GEOS geometry, I get an OGR geometry first and do the transform. Other than reducing transformation complexity (e.g., I'm not instantiating OGR geom within GEOSGeometry.transform), I don't know why this works -- which is why I have this ticket. See also this django-users thread.

mod_python configuration:

<VirtualHost *:80>

  <Location "/">
    SetHandler mod_python
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE settings
    PythonDebug On
    PythonPath "['/var/www/apps'] + sys.path"
  </Location>

  Alias /media/ "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/admin/media/"
  <Location "/media">
    SetHandler None
  </Location>
  
</VirtualHost>

mod_wsgi configuration:

<VirtualHost *:80>
  WSGIDaemonProcess geodjango user=geo group=geo processes=5 threads=1
  WSGIProcessGroup geodjango
  WSGIScriptAlias / /home/geo/geodjango/world.wsgi
  
  Alias /media/ "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/admin/media/"
  <Directory "/usr/lib/python2.5/site-packages/Django-1.0.2_final-py2.5.egg/django/contrib/admin/media/">
    Order allow,deny
    Options Indexes
    Allow from all
    IndexOptions FancyIndexing
  </Directory>
 
</VirtualHost>

Attachments (1)

geoadmin_fix_ubuntu8.10.diff (619 bytes) - added by jbronn 6 years ago.

Download all attachments as: .zip

Change History (7)

Changed 6 years ago by jbronn

comment:1 Changed 6 years ago by jbronn

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by adamfast@…

  • Cc adamfast@… added

I'm having the same issue, and this patch fixed it for me. CC'ing to follow future merge / etc.

comment:3 Changed 6 years ago by springmeyer

  • Cc dane.springmeyer@… added

comment:4 Changed 6 years ago by jbronn

  • Resolution set to fixed
  • Status changed from new to closed

(In [9733]) Fixed #9278, #9694 -- Geographic overlays now display in admin with right to left langauges; simplified transformation process in OpenLayersWidget to fix Ubuntu 8.10/Apache 2.2.9 crash; updated OpenLayers version to 2.7.

comment:5 Changed 6 years ago by jbronn

(In [9734]) [1.0.X] Fixed #9278, #9694 -- Geographic overlays now display in admin with right to left langauges; simplified transformation process in OpenLayersWidget to fix Ubuntu 8.10/Apache 2.2.9 crash; updated OpenLayers version to 2.7.

Backport of r9733 from trunk.

comment:6 Changed 6 years ago by anonymous

  • milestone post-1.0 deleted

Milestone post-1.0 deleted

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