Opened 5 months ago
Last modified 5 months ago
#35783 assigned New feature
Add the ability to natively filter geometries by the number of dimensions used by a Geometry.
Reported by: | David Smith | Owned by: | David Smith |
---|---|---|---|
Component: | GIS | Version: | 5.1 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | 18637 build:success | ||
Description ¶
PostGIS and 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 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.
According to the ticket's flags, the next step(s) to move this issue forward are:
- To improve the patch as described in the pull request review comments or on this ticket, then uncheck "Patch needs improvement".
If creating a new pull request, include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Change History (3)
comment:1 by , 5 months ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 5 months ago
Has patch: | set |
---|
comment:3 by , 5 months ago
Patch needs improvement: | set |
---|
PR has a an approval from Claude, but I'm setting the flag "patch needs improvement" until we clarify next steps for Oracle and potentially MySQL.