1

我正在尝试在 RHEL 6.5 机器上安装 geo-django 应用程序。该应用程序在 Ubuntu 12.04 (python 2.7, django 1.4, mapnik, ti​​lecache & postgis(9.1) enabled postgresql 9.1) 中运行良好。但是当我在 RHEL 6.5 中安装相同的,使用 geodjango API 的 postgis 查询不起作用。查询是

pt1 = MyModel.objects.filter(thegeom__dwithin=(the_geom, 250)).distance(the_geom).order_by('distance')

其中“the_geom”是另一个表中的几何值。

执行此查询时出现错误

“NoneType”对象没有属性“组”

回溯错误是

Traceback (most recent call last):
  File "<console>", line 2, in <module>
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/query.py", line 100, in distance
    return self._distance_attribute('distance', geom, **kwargs)
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/query.py", line 582, in _distance_attribute
    geodetic = geo_field.geodetic(connection)
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 131, in geodetic
    return self.units_name(connection) in self.geodetic_units
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 122, in units_name
    self._get_srid_info(connection)
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 108, in _get_srid_info
    self._units, self._units_name, self._spheroid = get_srid_info(self.srid, connection)
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 35, in get_srid_info
    units, units_name = sr.units
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/backends/base.py", line 280, in units
    return (self.linear_units, self.linear_name)
  File "/opt/MyApp/lib/python2.7/site-packages/django/contrib/gis/db/backends/base.py", line 252, in linear_units
    return m.group('unit')
    AttributeError: 'NoneType' object has no attribute 'group'
4

0 回答 0