Opened 10 months ago

Closed 2 months ago

#36009 closed New feature (fixed)

Add support for PostGIS 3.5

Reported by: David Smith Owned by: nessita <124304+nessita@…>
Component: GIS Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

PostGIS 3.5 was released on 26 September 2024.

My initial try showed that there is one test failure when using this new version that needs to be investigated.

======================================================================
ERROR: test_relate_lookup (gis_tests.geoapp.tests.GeoLookupTest.test_relate_lookup)
Testing the 'relate' lookup type.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\smith\projects\django\tests\gis_tests\geoapp\tests.py", line 581, in test_relate_lookup
    "Lawrence", City.objects.get(point__relate=(ks.poly, within_mask)).name
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\smith\projects\django\django\db\models\manager.py", line 87, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\smith\projects\django\django\db\models\query.py", line 633, in get
    raise self.model.DoesNotExist(
gis_tests.geoapp.models.City.DoesNotExist: City matching query does not exist.

Change History (11)

comment:1 by Claude Paroz, 10 months ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature
Version: 5.1dev

comment:2 by Mohammad Ali Mehdizadeh, 4 months ago

Last edited 4 months ago by Mohammad Ali Mehdizadeh (previous) (diff)

comment:3 by Natalia Bidart, 4 months ago

PR to run tests with PostGIS 3.5 (test pass) via a label-triggered GH action.

comment:4 by GitHub <noreply@…>, 4 months ago

In 8c56e939:

Refs #36009 -- Added GitHub action workflow to run tests with latest stable postgis version.

comment:5 by David Smith, 3 months ago

The test_relate_lookup is failing with PostGIS, and (I'm fairly sure) with GEOS 3.13+. PostGIS made a change to the way "relate" works when GEOS 3.13 is available so I'm guessing this is relavent https://trac.osgeo.org/postgis/ticket/5770. PostGIS will now use the new implementation for "relate" which is available in GEOS 3.13. see docs on RelateNG

Running the tests with --debug-sql, I get the output seen here. Happy to post to trac, but the "wkb" for Kansas is quite big.

If I connect to the database, load the values for Lawrence and run the same query, I get one result (Lawrence). However, that same query being run by Django's returns 0 results. I'm unsure how to continue to debug this.

insert into geoapp_city values
(1, 'Lawrence', 'POINT (-95.235060 38.971823)')

comment:6 by Natalia Bidart, 3 months ago

Thank you David for the debugging information. One thing I'm not sure I follow is:

  • test_relate_lookup works with PostGIS 3.5 and GEOS 3.9 (this is the confg in the new GHA workflow), but
  • test_relate_lookup fails with PostGIS 3.5 and GEOS 3.13 (this is the failure posted in this ticket).

Given the above, and given than RelateNG is provided by GEOS and its implementation changed in 3.13, shouldn't the issue be that we need to (re) confirm support for GEOS 3.13? Seems like we should close this ticket as fixed and re-open #35775.

comment:7 by Natalia Bidart, 3 months ago

Has patch: set
Patch needs improvement: set

comment:8 by David Smith, 2 months ago

Patch needs improvement: unset

comment:9 by Natalia Bidart, 2 months ago

Triage Stage: AcceptedReady for checkin

comment:10 by nessita <124304+nessita@…>, 2 months ago

In d0113c17:

Refs #36009 -- Adjusted gis_tests.geoapp.tests.GeoLookupTest.test_relate_lookup for bug in PostGIS.

ST_Relate() with PostGIS 3.5 and GEOS 3.13 gives a different result when
a series of calls are made vs. single call of the same function.

The fix for this is expected to be released in PostGIS 3.5.4 and 3.6.0.

https://lists.osgeo.org/pipermail/postgis-devel/2025-July/030581.html
https://trac.osgeo.org/postgis/ticket/5938

comment:11 by nessita <124304+nessita@…>, 2 months ago

Owner: set to nessita <124304+nessita@…>
Resolution: fixed
Status: newclosed

In 1909108:

Fixed #36009 -- Confirmed support for PostGIS 3.5.

Note: See TracTickets for help on using tickets.
Back to Top