Opened 37 minutes ago
#37236 new Bug
Spatial indexes cannot be added, removed, or altered on RasterField
| Reported by: | Jacob Walls | Owned by: | |
|---|---|---|---|
| Component: | GIS | Version: | 6.0 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
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:
-
tests/gis_tests/gis_migrations/test_operations.py
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 b class OperationTests(OperationTestCase): 281 281 if not self.has_spatial_indexes: 282 282 self.skipTest("No support for Spatial indexes") 283 283 284 self.assertSpatialIndexExists("gis_neighborhood", " geom")284 self.assertSpatialIndexExists("gis_neighborhood", "rast", raster=True) 285 285 286 286 self.alter_gis_model( 287 287 migrations.AlterField, 288 288 "Neighborhood", 289 " geom",289 "rast", 290 290 fields.MultiPolygonField, 291 291 field_class_kwargs={"spatial_index": False}, 292 292 ) 293 self.assertSpatialIndexNotExists("gis_neighborhood", " geom")293 self.assertSpatialIndexNotExists("gis_neighborhood", "rast", raster=True) 294 294 295 295 @skipUnlessDBFeature("can_alter_geometry_field") 296 296 @skipUnless(connection.vendor == "mysql", "MySQL specific test")
====================================================================== 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
Note:
See TracTickets
for help on using tickets.