I am having a problem with the latest version of the GeoDjango
extensions in Django version 4.2.6 when I create an empty LineString
. The same code is behaving differently than it did in version 4.0.10. The default seems to have switched to creating a Geos object with 3-dimensions rather than the previous 2-dimensions.
The following code returns a different WKT object depending on the version of Django I am using.
from django.contrib.gis.geos import LineString
ls = LineString()
ls.wkt
This is returning a 3-dimensional object "LINESTRING Z EMPTY". Running exactly the same code on Django 4.0.10 creates a 2-dimension object "LINESTRING EMPTY".
Is there anything obvious I am doing wrong? I am also running a slightly newer version of geos-3.12.0 versus 3.11.2 but I cannot see anything is both sets of release notes that describe this change in behaviour.
This issue turned out to be due to a change in the way geos handles empty LineString objects. This has now been corrected in a patch to the master branch. See https://github.com/libgeos/geos/issues/993 for the details of the issue and the patch that fixes it.