<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Thank you very much, that is exactly what I need.</p>
<p>Simon</p>
<p><br>
</p>
<div class="moz-cite-prefix">Am 08.03.2019 um 02:35 schrieb Nyall
Dawson:<br>
</div>
<blockquote type="cite"
cite="mid:CAB28Asio8hHw81jfvs9mypN+s7yf=PVXRGe+wVnE9e8vpCcK1w@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">On Thu, 7 Mar 2019 at 19:12, Simon Gröchenig
<a class="moz-txt-link-rfc2396E" href="mailto:simon.groechenig@salzburgresearch.at"><simon.groechenig@salzburgresearch.at></a> wrote:
</pre>
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">
Hi all,
I have a question concerning the line_substring and recently updated $length expressions. I have a linestring (EPSG:4326) and a relative start- and end-offset (in %) and I want to create the sub linestring. The start- and end distances at the line_substring expression should be set in projection units (e.g. degrees in EPSG:4326). With the previous behaviour of $length, I multiplied the relative offset (in %) with the (planimetric) length to calculate those distances. See the following example:
geom_to_wkt(line_substring( geom_from_wkt('LINESTRING(13 46, 15 46)'), 0.4* $length, 0.6* $length)) // $length => 2.0
results in
LINESTRING(13.8 46, 14.2 46)
With the latest release (3.6.0-1 und 3.4.5-1), the $length expression correctly calculates the ellipsoidal length (<a class="moz-txt-link-freetext" href="https://issues.qgis.org/issues/19355">https://issues.qgis.org/issues/19355</a>) and I cannot use the above expression. Is there a way to use relative distances in the line_substring function? Or is there an alternative to calculate the planimetric length (without implementing my own function)?
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
Yes -- the "length(...)" function always gives a purely Cartesian
length for a geometry. Using "length($geometry)" should give you what
you want.
Nyall
</pre>
</blockquote>
</body>
</html>