I would like to know what's the best way to find the Y
value of an interpolated point inside the Linestring
, when given the X
.
The X
coordinates of my input Linestring
will always be incremental and non sequential (as in the example below). The Y
values could be any real number.
LINESTRING(223 -59,228 -59.3,233 -59.7,242 -60,263 -60.4,
268 -61.7,275 -62.1,280 -62.5)
Given an X
value (let's say 270
for example), the query would output the interpolated value inside the Linestring
(in this case it would be -61.81428571
, using points [268 -61.7]
and [275 -62.1]
for the interpolation)
If the X
value already belongs to the Linestring
, the it would just output its corresponding Y
value. 268: -61.7
The input table will just have a single column with a single row with the linestring.
The X
value would be part of the query.
I'm using PostGIS.