[Django] #37236: Spatial indexes cannot be added, removed, or altered on RasterField

3 views
Skip to first unread message

Django

unread,
Jul 28, 2026, 1:15:34 PM (yesterday) Jul 28
to django-...@googlegroups.com
#37236: Spatial indexes cannot be added, removed, or altered on RasterField
-----------------------------+--------------------------------------
Reporter: Jacob Walls | Type: Bug
Status: new | Component: GIS
Version: 6.0 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
`RasterField` allows spatial indexes `spatial_index=True` just like
`GeometryField`, but the support for adding/removing/altering spatial
indexes in #35074 only checked `GeometryField` instead of
`BaseSpatialField`.

For the purposes of testing only, see this diff:
{{{#!diff
diff --git a/tests/gis_tests/gis_migrations/test_operations.py
b/tests/gis_tests/gis_migrations/test_operations.py
index 98201ed3f7..98f327cc2b 100644
--- a/tests/gis_tests/gis_migrations/test_operations.py
+++ b/tests/gis_tests/gis_migrations/test_operations.py
@@ -281,16 +281,16 @@ class OperationTests(OperationTestCase):
if not self.has_spatial_indexes:
self.skipTest("No support for Spatial indexes")

- self.assertSpatialIndexExists("gis_neighborhood", "geom")
+ self.assertSpatialIndexExists("gis_neighborhood", "rast",
raster=True)

self.alter_gis_model(
migrations.AlterField,
"Neighborhood",
- "geom",
+ "rast",
fields.MultiPolygonField,
field_class_kwargs={"spatial_index": False},
)
- self.assertSpatialIndexNotExists("gis_neighborhood", "geom")
+ self.assertSpatialIndexNotExists("gis_neighborhood", "rast",
raster=True)

@skipUnlessDBFeature("can_alter_geometry_field")
@skipUnless(connection.vendor == "mysql", "MySQL specific test")
}}}
{{{#!py
======================================================================
FAIL: test_alter_field_remove_spatial_index
(gis_tests.gis_migrations.test_operations.OperationTests.test_alter_field_remove_spatial_index)
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/Users/jwalls/django/tests/gis_tests/gis_migrations/test_operations.py",
line 293, in test_alter_field_remove_spatial_index
self.assertSpatialIndexNotExists("gis_neighborhood", "rast",
raster=True)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/Users/jwalls/django/tests/gis_tests/gis_migrations/test_operations.py",
line 99, in assertSpatialIndexNotExists
self.assertFalse(
~~~~~~~~~~~~~~~~^
any(
^^^^
...<3 lines>...
)
^
)
^
AssertionError: True is not false
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37236>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jul 28, 2026, 2:00:16 PM (yesterday) Jul 28
to django-...@googlegroups.com
#37236: Spatial indexes cannot be added, removed, or altered on RasterField
-----------------------------+------------------------------------
Reporter: Jacob Walls | Owner: (none)
Type: Bug | Status: new
Component: GIS | Version: 6.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Changes (by Simon Charette):

* stage: Unreviewed => Accepted

--
Ticket URL: <https://code.djangoproject.com/ticket/37236#comment:1>
Reply all
Reply to author
Forward
0 new messages