# How does SDE.ST_LENGTH() get calculated?

I have an Oracle 18c SDE.ST_GEOMETRY polyline FC. The lines in the FC have true curves.

If I query for the length of the lines in SQL using `SDE.ST_LENGTH(SHAPE)`, how does the length get calculated?

1. Using the ST_GEOMETRY parallel approximation of the lines -- where the true curves are densified into straight segments?

2. Or, does the length come from the CAD BLOB -- with the true curves factored into the length?

It would also be interesting to know how the `LEN` ST_GEOMETRY.attribute gets calculated: ST_Geometry in Oracle. I assume that's basically the same question as what I asked above.

I'm wondering if there is a way to find lines that have true curves -- by somehow comparing the length of the line including the curves -- vs. the length of the line where the curves have been densified by ST_GEOMETRY. If there is a difference in length, then that could be an indication that there are true curves.

• When you have a true circle of radius r does its length/perimeter appear to come back as exactly 2*pi*r or is it a bit different to that? The answer should allow you to reduce the number of questions you ask in your question body.
– PolyGeo
Commented Feb 28, 2022 at 5:35
• There's some discussion here math.stackexchange.com/questions/12186/… on computing the length of Bezier curves (not sure if your curves are defined as Bezier, or spline, or what) which can be done exactly. So you could try that to work out if its being used or a linear approximation. But I also suspect only Oracle know and for the price you pay I would hope they would tell you if you asked them... Commented Feb 28, 2022 at 7:05

As far as I can tell, the answer is #1 from the original post:

1. SDE.ST_LENGTH(SHAPE) uses the ST_GEOMETRY parallel approximation of the lines. The true curves are pre-densified into straight segments.

Testing:

I drew a line in ArcMap that has true curves:

And then I selected the length in various ways using SQL:

``````select
objectid,
sde.st_length(shape) st_length,
sde.st_numPOints(shape) st_numpoints,
a.shape.len,
a.shape.numpts,
sde.st_length(sde.st_geometry(sde.st_astext(shape), 26917)) as wkt_densified_length
from
my_fc a
``````

Result:

All of the lengths are the same, including a length/shape that I densified deliberately (`WKT_DENSIFIED_LENGTH`).

If I understand correctly, that means that the shape was pre-densified before any of the lengths were calculated. I don't seem to have access to any undensified lengths using SQL.

To be honest, I don’t understand why SQL's densified lengths are the same as the true/undensified SHAPE.LEN in ArcMap.

I did a different test in ArcMap, where I densified the line using a Python Field Calculator tool (densified to 0.0925025 radians; aka 5.3 degrees; 60 vertices). And to my surprise, the ArcMap SHAPE.LEN was noticeably different than the densified lengths in SQL. I'm not sure why the densified SHAPE.LEN in ArcMap is different from the SQL densified lengths. Screenshot.