[Django] #33787: GeosGeometry doesn't support empty 3d points

7 views
Skip to first unread message

Django

unread,
Jun 15, 2022, 10:34:56 AM6/15/22
to django-...@googlegroups.com
#33787: GeosGeometry doesn't support empty 3d points
---------------------------------------+------------------------
Reporter: Nicolas Noé | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 4.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 |
---------------------------------------+------------------------
I need to create an empty 3d point using GeosGeometry, but it appears the
z dimension gets lost in the process:

{{{
In [1]: from django.contrib.gis.geos import GEOSGeometry

In [2]: g = GEOSGeometry('POINT Z EMPTY', srid=4326)

In [3]: g.ewkt
Out[3]: 'SRID=4326;POINT EMPTY'

In [4]: g.hasz
Out[4]: False
}}}


I'd expect g.ewkt to be 'SRID=4326;POINT EMPTY' and g.hasz to be True. As
a consequence, I can't assign it to a 3d model field.

I see the correct behavior if I use a non empty 3d point:

{{{
In [13]: g_non_empty = GEOSGeometry('POINT Z (1 1 1)', srid=4326)

In [14]: g_non_empty.hasz
Out[14]: True

In [15]: g_non_empty.ewkt
Out[15]: 'SRID=4326;POINT Z (1 1 1)'
}}}

I also tried creating the same feature using EWKB
(0x0101000080000000000000F87F000000000000F87F000000000000F87F is a 3D
empty point), but the third dimension is also lost here, just like in the
first example.

--
Ticket URL: <https://code.djangoproject.com/ticket/33787>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 15, 2022, 11:53:01 AM6/15/22
to django-...@googlegroups.com
#33787: GeosGeometry doesn't support empty 3d points
-----------------------------+--------------------------------------

Reporter: Nicolas Noé | Owner: nobody
Type: Bug | Status: new
Component: GIS | Version: 4.0
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Description changed by Nicolas Noé:

Old description:

> I need to create an empty 3d point using GeosGeometry, but it appears the
> z dimension gets lost in the process:
>
> {{{
> In [1]: from django.contrib.gis.geos import GEOSGeometry
>
> In [2]: g = GEOSGeometry('POINT Z EMPTY', srid=4326)
>
> In [3]: g.ewkt
> Out[3]: 'SRID=4326;POINT EMPTY'
>
> In [4]: g.hasz
> Out[4]: False
> }}}
>

> I'd expect g.ewkt to be 'SRID=4326;POINT EMPTY' and g.hasz to be True.
> As a consequence, I can't assign it to a 3d model field.
>
> I see the correct behavior if I use a non empty 3d point:
>
> {{{
> In [13]: g_non_empty = GEOSGeometry('POINT Z (1 1 1)', srid=4326)
>
> In [14]: g_non_empty.hasz
> Out[14]: True
>
> In [15]: g_non_empty.ewkt
> Out[15]: 'SRID=4326;POINT Z (1 1 1)'
> }}}
>
> I also tried creating the same feature using EWKB
> (0x0101000080000000000000F87F000000000000F87F000000000000F87F is a 3D
> empty point), but the third dimension is also lost here, just like in the
> first example.

New description:

I need to create an empty 3d point using GeosGeometry, but it appears the
z dimension gets lost in the process:

{{{
In [1]: from django.contrib.gis.geos import GEOSGeometry

In [2]: g = GEOSGeometry('POINT Z EMPTY', srid=4326)

In [3]: g.ewkt
Out[3]: 'SRID=4326;POINT EMPTY'

In [4]: g.hasz
Out[4]: False
}}}


I'd expect g.ewkt to be 'SRID=4326;POINT Z EMPTY' and g.hasz to be True.


As a consequence, I can't assign it to a 3d model field.

I see the correct behavior if I use a non empty 3d point:

{{{
In [13]: g_non_empty = GEOSGeometry('POINT Z (1 1 1)', srid=4326)

In [14]: g_non_empty.hasz
Out[14]: True

In [15]: g_non_empty.ewkt
Out[15]: 'SRID=4326;POINT Z (1 1 1)'
}}}

I also tried creating the same feature using EWKB
(0x0101000080000000000000F87F000000000000F87F000000000000F87F is a 3D
empty point), but the third dimension is also lost here, just like in the
first example.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/33787#comment:1>

Django

unread,
Jun 15, 2022, 2:56:34 PM6/15/22
to django-...@googlegroups.com
#33787: GeosGeometry doesn't support empty 3d points
-----------------------------+--------------------------------------
Reporter: Nicolas Noé | Owner: nobody
Type: Bug | Status: closed
Component: GIS | Version: 4.0
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => invalid


Comment:

Thanks for the report, however, this looks like an issue in GEOS not in
Django itself (see e.g. https://trac.osgeo.org/geos/ticket/1005). Django
doesn't do anything special with the WKT. I'd try to report/discuss this
in GEOS bug tracker.

--
Ticket URL: <https://code.djangoproject.com/ticket/33787#comment:2>

Reply all
Reply to author
Forward
0 new messages