0

使用英国数据加载 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".
4

1 回答 1

0

The Boundary-Line data you imported had a couple of invalid geometries in it, which import fine but then error when trying to be used in geospatial calculations.

The import script has been updated to try and fix such boundaries at import stage: https://github.com/mysociety/mapit/commit/e20425be025cfece2c7172774a4d1202fe068704

You can either import the data again using that updated command, or manually fix the data in your database before running mapit_UK_find_parents (you also need --commit to that call to save the data). To manually fix, you would need to run a script similar to mapit_UK_fix_2014-05 (https://github.com/mysociety/mapit/blob/master/mapit_gb/management/commands/mapit_UK_fix_2014-05.py), but with the W04/W05 lines removed - as those boundaries were removed from the October 2014 edition of Boundary-Line.

于 2014-12-05T20:48:00.633 回答