GeoDjango:基本地理查询的例外情况

GeoDjango:基本地理查询的例外情况,django,geodjango,geos,Django,Geodjango,Geos,在我的开发环境中,GeoDjango在SpatiaLite上运行时遇到地理查询问题 from django.contrib.gis.db import models class Test(models.Model): poly = models.PolygonField() point = models.PointField() geom = models.GeometryField() objects = models.GeoManager() 通过外壳进行

在我的开发环境中,GeoDjango在SpatiaLite上运行时遇到地理查询问题

from django.contrib.gis.db import models

class Test(models.Model):
    poly = models.PolygonField()
    point = models.PointField()
    geom = models.GeometryField()
    objects = models.GeoManager()
通过外壳进行测试:

>>> from geotest.models import Test
>>> from django.contrib.gis.geos import GEOSGeometry
>>> 
>>> point = GEOSGeometry("POINT(0 0)")
>>> point
<Point object at 0x105743490>
>>> poly = GEOSGeometry("POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))")
>>> poly
<Polygon object at 0x105743370>
>>> 
django炮弹也死了。以及在以下范围内:


其他组合也会导致各种例外情况。我一定错过了一些明显的东西,因为这些都是非常基本的。有什么想法吗?

你的要求似乎是正确的

你检查过你是否符合所有要求了吗

您是否正确初始化了spatialite数据库


谢谢你的回复。我删除了现有数据库并从头开始使用新数据库,但我得到了完全相同的错误:
>>> Test.objects.filter(point__within=poly)
Assertion failed: (0), function appendGeometryTaggedText, file WKTWriter.cpp, line 228.
Abort trap
>>> Test.objects.filter(poly__contains=point)
GEOS_ERROR: Geometry must be a Point or LineString
Traceback (most recent call last):
...
GEOSException: Error encountered checking Coordinate Sequence returned from GEOS C function "GEOSGeom_getCoordSeq_r".
>>>