Note that there are some explanatory texts on larger screens.

plurals
  1. POGeoDjango: Exceptions for basic geographic queries
    primarykey
    data
    text
    <p>I am having problems with geographic queries with GeoDjango running on SpatiaLite on my development environment. </p> <pre><code>from django.contrib.gis.db import models class Test(models.Model): poly = models.PolygonField() point = models.PointField() geom = models.GeometryField() objects = models.GeoManager() </code></pre> <p>Testing via shell:</p> <pre><code>&gt;&gt;&gt; from geotest.models import Test &gt;&gt;&gt; from django.contrib.gis.geos import GEOSGeometry &gt;&gt;&gt; &gt;&gt;&gt; point = GEOSGeometry("POINT(0 0)") &gt;&gt;&gt; point &lt;Point object at 0x105743490&gt; &gt;&gt;&gt; poly = GEOSGeometry("POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))") &gt;&gt;&gt; poly &lt;Polygon object at 0x105743370&gt; &gt;&gt;&gt; </code></pre> <p>With these definitions, lets try some basic geographic queries. First <code>contains</code>:</p> <pre><code>&gt;&gt;&gt; Test.objects.filter(point__within=poly) Assertion failed: (0), function appendGeometryTaggedText, file WKTWriter.cpp, line 228. Abort trap </code></pre> <p>And the django shell dies. And with <code>within</code>:</p> <pre><code>&gt;&gt;&gt; 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". &gt;&gt;&gt; </code></pre> <p>Other combinations also cause a variety of exceptions. I must be missing something obvious as these are very basic. Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload