Opened 16 years ago

Last modified 16 years ago

#9694 closed

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

Reported by: jbronn Owned by: jbronn
Component: GIS Version: dev
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: no UI/UX: no

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>

Change History (2)

by jbronn, 16 years ago

comment:1 by jbronn, 16 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top