mirror of
				https://github.com/django/django.git
				synced 2025-10-31 09:41:08 +00:00 
			
		
		
		
	Fixed LayerMapping with Oracle 23c.
Oracle 23c collapses MULTI geometries with only one entry to their non-MULTI type. Added check when loading geometries from the database that a MULTI type is returned. Reconvert to correct geometry type, if required.
This commit is contained in:
		| @@ -646,6 +646,14 @@ class LayerMapping: | ||||
|                             else: | ||||
|                                 geom = geom_value.ogr | ||||
|                                 new = OGRGeometry(kwargs[self.geom_field]) | ||||
|                                 if ( | ||||
|                                     geom_typeid := geom.geos.geom_typeid | ||||
|                                 ) in self.MULTI_TYPES: | ||||
|                                     # Database returned non-MULTI type, reconvert. | ||||
|                                     multi_type = self.MULTI_TYPES[geom_typeid] | ||||
|                                     g = OGRGeometry(multi_type) | ||||
|                                     g.add(geom) | ||||
|                                     geom = g | ||||
|                                 for g in new: | ||||
|                                     geom.add(g) | ||||
|                             setattr(m, self.geom_field, geom.wkt) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user