【问题标题】:MapIt - Loading data getting GEOSExceptionMapIt - 加载数据获取 GEOSException
【发布时间】:2014-10-30 16:14:42
【问题描述】:

在使用英国数据加载 mapit 时遇到此问题(根据本指南:http://mapit.poplus.org/docs/self-hosted/import/uk/

我正在运行这个命令:./manage.py mapit_UK_find_parents

Parent for Colton [10193] (CPC) was None, is now South Lakeland District Council [1763] (DIS)
Parent for Colton [16211] (CPC) was None, is now Lichfield District Council [1908] (DIS)
Parent for Colton [14639] (CPC) was None, is now Selby District Council [1883] (DIS)
Parent for Colton and Mavesyn Ridware [5835] (DIW) was None, is now Lichfield District Council [1908] (DIS)
GEOS_ERROR: TopologyException: found non-noded intersection between LINESTRING (524864 545.5, 524859 540.2) and LINESTRING (524859 540.2, 524859 540.2) at 524859 540.2
Traceback (most recent call last):
    File "./manage.py", line 11, in <module>
        execute_manager(settings)
    File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 438, in execute_manager
        utility.execute()
    File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 379, in execute
        self.fetch_command(subcommand).run_from_argv(self.argv)
    File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 191, in run_from_argv
        self.execute(*args, **options.__dict__)
    File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 220, in execute
        output = self.handle(*args, **options)
    File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 351, in handle
        return self.handle_noargs(**options)
    File "/var/www/mapit/mapit/mapit/management/commands/mapit_UK_find_parents.py", line 52, in handle_noargs
        'polygons__polygon__contains': polygon.polygon.point_on_surface,
    File "/usr/lib/python2.7/dist-packages/django/contrib/gis/geos/geometry.py", line 593, in point_on_surface
        return self._topology(capi.geos_pointonsurface(self.ptr))
    File "/usr/lib/python2.7/dist-packages/django/contrib/gis/geos/prototypes/threadsafe.py", line 49, in __call__
        return self.cfunc(self.thread_context.handle.ptr, *args)
    File "/usr/lib/python2.7/dist-packages/django/contrib/gis/geos/prototypes/errcheck.py", line 43, in check_geom
        raise GEOSException('Error encountered checking Geometry returned from GEOS C function "%s".' % func.__name__)
django.contrib.gis.geos.error.GEOSException: Error encountered checking Geometry returned from GEOS C function "GEOSPointOnSurface_r".

【问题讨论】:

  • SELECT PostGIS_Full_Version(); 的输出添加到您的问题中
  • 这是一个 GEOS 错误——我在复杂的查询中见过几次类似的情况。它当然与 Django 本身无关。您很可能需要在 Django 设置之外修复有问题的几何图形。如果您发布该区域边界的实际几何图形,这将有所帮助。

标签: django postgis geodjango geos


【解决方案1】:

您导入的边界线数据中有几个无效的几何图形,它们可以正常导入,但在尝试用于地理空间计算时会出错。

导入脚本已更新以尝试在导入阶段修复此类边界:https://github.com/mysociety/mapit/commit/e20425be025cfece2c7172774a4d1202fe068704

您可以使用更新后的命令再次导入数据,或者在运行mapit_UK_find_parents 之前手动修复数据库中的数据(您还需要--commit 调用该调用来保存数据)。要手动修复,您需要运行类似于 mapit_UK_fix_2014-05 (https://github.com/mysociety/mapit/blob/master/mapit_gb/management/commands/mapit_UK_fix_2014-05.py) 的脚本,但删除了 W04/W05 行 - 因为这些边界已从 2014 年 10 月版的 Boundary-Line 中删除。

【讨论】:

    猜你喜欢
    • 2021-01-07
    • 2014-10-08
    • 1970-01-01
    • 2013-09-09
    • 2011-11-13
    • 1970-01-01
    • 2019-02-03
    • 2021-11-07
    • 1970-01-01
    相关资源
    最近更新 更多