psycopg2.errors.InternalError_: GEOSTopologyPreserveSimplify: IllegalArgumentException: CGAlgorithmsDD::orientationIndex encountered NaN/Inf numbers

Bharath Tadikonda tadikondabharath at gmail.com
Tue Jul 29 12:25:39 PDT 2025


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:

   1.

   *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?*
   2.

   Would upgrading to *GEOS 3.13.1* with *PostGIS 3.4.3* on-prem likely
   resolve this issue?
   3.

   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*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20250729/87a528dc/attachment.htm>


More information about the postgis-users mailing list