I'm using ST_ReducePrecision in PostGIS to lower the tolerance of shapes so they can be read by ArcMap.
I'm applying ST_ReducePrecision(shape, 0.0001)
with a tolerance of 0.0001 to match ArcMap's tolerance threshold. However, I'm encountering inconsistencies: some layers throw a TopologyException
error when reducing their precision, and I have to lower the tolerance threshold further to avoid this error. I noticed that the function returns an empty polygon in some cases as well. Why does this happen, and how can I resolve it?
ERROR: lwgeom_reduceprecision: GEOS Error: TopologyException: Ring edge missing at -81.0762 40.416499999999999
Example shapes throwing error:
'POLYGON((-81.07617417999995 40.41644104000005,-81.07564138383023 40.41651771771441,-81.0761647459999 40.41641947000005,-81.07618946678375 40.4164759888721,-81.07617417999995 40.41644104000005))'
'POLYGON((-80.94533513799996 40.688838678000025,-80.94608381135927 40.68981923891161,-80.94607828799991 40.690919819999976,-80.94606284029669 40.69354660600186,-80.94606512299987 40.6935466450002,-80.94605917499985 40.69473439700005,-80.9460588479999 40.69479968600001,-80.94605846900004 40.694868292000194,-80.94605805499992 40.69495063800008,-80.9459727269998 40.70219608699995,-80.94597236899983 40.70222642900018,-80.94349159199993 40.70219077000013,-80.93963737799987 40.70213525999998,-80.93970467099984 40.70069341300018,-80.93982688900002 40.698453888000245,-80.9398648729998 40.69754836600009,-80.93979271300003 40.69754821200007,-80.93633854399991 40.69754077100009,-80.93633969399991 40.69738355100003,-80.9363453819999 40.696642410000095,-80.93528609999993 40.695559449000086,-80.93526858999991 40.69554154800011,-80.936313112 40.69485608499997,-80.9363592929999 40.69482577800005,-80.93639832299993 40.69482600000009,-80.93779095799988 40.694833912000206,-80.93999666199994 40.69484640500008,-80.94002425499991 40.69401579800018,-80.9400313029999 40.6934423030001,-80.94003871099989 40.692839499000115,-80.94003876799991 40.69283479000018,-80.94005684653133 40.69136296938674,-80.94072258005211 40.69104458882698,-80.94147380699985 40.69084031000017,-80.94161899999989 40.6908008270002,-80.94385607399988 40.6901824680001,-80.94392788699997 40.689732874000185,-80.94387054697607 40.689539104365004,-80.94533513799996 40.688838678000025),(-80.94017029099996 40.69344505000004,-80.94132916299998 40.693465046000085,-80.94606283300004 40.69354787200018,-80.9400313029999 40.6934423030001,-80.94017029099996 40.69344505000004),(-80.94065147099985 40.694853976000104,-80.94031648600003 40.69485191299998,-80.94124708599986 40.694867935000104,-80.94065147099985 40.694853976000104))'