﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35783	Add the ability to natively filter geometries by the number of dimensions used by a Geometry.	David Smith	David Smith	"[https://postgis.net/docs/ST_NDims.html PostGIS] and [https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.2.0.html SpatiaLite]  have a `ST_NDims` function which returns the number of dimensions a geometry. I propose to add a function similar to what is proposed for `GeometryType` in #28696.

Support for Oracle should also be possible with its `GET_DIMS( )` function see [https://docs.oracle.com/cd/B10500_01/appdev.920/a96630/sdo_meth.htm#BABDEBJA docs ]. However, I couldn't find a similar function on MySQL/MariaDB. 

An implementation for PostGIS/SpatiaLite would look something like this. 

{{{
class NumDimensions(GeoFunc):
    function = ""ST_NDims""
    output_field = IntegerField()
    arity = 1
}}}

Which would allow this to be used in QuerySets such as annotating the number of dimensions in a geometry. 

{{{Country.objects.annotate(num_dims=functions.NumDimensions(""geom""))}}}

I'll prepare a patch if accepted. "	New feature	closed	GIS	5.1	Normal	fixed			Ready for checkin	1	0	0	0	0	0
