Re: psycopg2.errors.InternalError_: GEOSTopologyPreserveSimplify: IllegalArgumentException: CGAlgorithmsDD::orientationIndex encountered NaN/Inf numbers
Paul Ramsey via postgis-users <[email protected]> Tue, 29 Jul 2025 12:39:40 -0700
| Newsgroups | gmane.comp.gis.postgis |
|---|---|
| Message-ID | <[email protected]> |
This entry from the 3.12.3 changelog seems pertinent - DouglasPeuckerLineSimplifier, avoid crash with Point input and NaN tolerance (GH-1078, Dan Baston) Running the latest patch releases is always the best practice. P. > On Jul 29, 2025, at 12:25 PM, Bharath Tadikonda <[email protected]> wrote: > > Team, > > Dear PostGIS Team, > We’re encountering the following exception during execution of a spatial operation in our Python application using PostGIS: > > > > psycopg2.errors.InternalError_: GEOSTopologyPreserveSimplify: IllegalArgumentException: CGAlgorithmsDD::orientationIndex encountered NaN/Inf numbers > This error arises from a call to ST_TopologyPreserveSimplify() in our function that processes and simplifies geometry. > > After some investigation, our development team suspects the issue is related to the PostGIS and GEOS versions installed in different environments: > > 🔴 Validation Environment — Not Working > > > SELECT postgis_full_version(); > -- POSTGIS="3.4.0 0874ea3" [EXTENSION] PGSQL="160" GEOS="3.12.2-CAPI-1.18.2" ... > ✅ Production (AWS RDS) — Working Fine > > > SELECT postgis_full_version(); > -- POSTGIS="3.4.3 e365945" [EXTENSION] PGSQL="160" GEOS="3.13.0-CAPI-1.19.0" ... > It appears that the error occurs only on PostGIS 3.4.0 with GEOS 3.12.2, while the same code works as expected in environments with PostGIS 3.4.3 and GEOS 3.13.0. > > Currently, we are unable to find and install GEOS 3.13.0 on-prem and only see GEOS 3.13.1 as available. > We’d appreciate your guidance on the following: > > Has this issue (NaN/Inf handling in ST_TopologyPreserveSimplify) been addressed between PostGIS 3.4.0 and 3.4.3 or GEOS 3.12 → 3.13? > > Would upgrading to GEOS 3.13.1 with PostGIS 3.4.3 on-prem likely resolve this issue? > > What is the best practice to keep PostGIS + GEOS versions in sync between on-prem and cloud (AWS RDS) environments? > > Thank you for your support and any insights you can share. > > Best regards, > Bharath > >