ST_HasArc
What is ST_HasArc?
ST_HasArc is a PostGIS function that returns true if a geometry contains a circular-arc component — a CIRCULARSTRING, CURVEPOLYGON, COMPOUNDCURVE, MULTISURFACE, or MULTICURVE — and false otherwise.
ST_HasArc(geometry g) → booleanUseful for validating input or choosing a code path when your pipeline handles curved geometries specially.
When would you use ST_HasArc?
Use ST_HasArc when working with datasets that can contain curved geometries (CAD imports, survey data, some aeronautical formats) and you need to route them through a curve-aware branch or linearize them first:
1SELECT id, geom,
2 CASE WHEN ST_HasArc(geom)
3 THEN ST_CurveToLine(geom)
4 ELSE geom
5 END AS linearized
6FROM imported_features;Many PostGIS functions only support linear geometries; calling ST_HasArc before passing to a picky function (or materializing a linearized version with ST_CurveToLine) prevents runtime errors.
FAQs
What counts as an arc?
Any occurrence of CIRCULARSTRING, CURVEPOLYGON, COMPOUNDCURVE, MULTICURVE, or MULTISURFACE anywhere in the geometry tree. Plain LINESTRING and POLYGON return false.
How do I remove arcs from a geometry?
Use ST_CurveToLine(geom) to linearize arcs into dense linestrings. The inverse is ST_LineToCurve but is less commonly needed.
Why would ST_HasArc matter to me if I only import GeoJSON and Shapefiles?
Those formats do not carry curves, so ST_HasArc will be false on their imports. If you never import CAD, KML with curves, or GML, you likely never need this function.
What is the performance of ST_HasArc?
Very cheap — it is a metadata check without vertex iteration. Safe to use as a filter on large tables.