Postgis St_Offsetcurve Fails for Some Lines

Using PostgreSQL and PostGIS I get an error when using ST_OffsetCurve for some specific line geometries: "lwgeom_offsetcurve: noded geometry cannot be offset"

Example:

SELECT ST_OffsetCurve(ST_GeomFromText('LINESTRING(288249.918098328 5615135.51135102,288293.425429089 5615086.62800628,288231.885629119 5615155.77174104,288249.918098328 5615135.51135102)'), -5.6875)

This is a closed line and the last three points are on a straight line. PostGIS version is 3.0 on Windows.

Changing any coordinates or even just the offset value slightly removes this error. Is it possible to prevent the error without changing numeric values?

3

2 Answers

Update to PostGIS version 3.1 solved the issue.

1

maybe ST_MakeValid fix this problem

And it is also better to pass srid as second parametr in ST_GeomFromText

SELECT ST_OffsetCurve(ST_MakeValid(ST_GeomFromText(...., your srid)), -5.6875)
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest