Bug report #19756

the line_interpolate_point function does not work with EPSG 4326

Added by salvatore fiandaca about 2 years ago. Updated about 2 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Expressions
Affected QGIS version:3.3(master) Regression?:No
Operating System:win 10 64b OSGEO4W Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:27581

Description

I attach a shapefile linestring in EPSG 4326 and I ask you to do the
following test:
add a text field - long 80 - and populate it with the following
expression:

geom_to_wkt (line_interpolate_point ($ geometry, $ length / 2))

then exported to csv to verify the points.

result: point on the first vertex
expected result: central point along the line

In QGIS 2.18.23 LTR the field is filled out but the coordinates are of the first one
vertex and not the expected one of the centroid along the line;
In QGIS 3.2.2 the field is filled out but the coordinates are of the first one
vertex and not the expected one of the centroid along the line;
In QGIS 3.3 dev the field is NOT compiled, or rather the value is NULL

in all three versions the expression works well if used for
thematize with geometry generator

bug_line_interpolate_point_4326.7z - shapefile - linestring EPSG 4326 (1.07 KB) salvatore fiandaca, 2018-09-03 02:31 PM

QGIS_DEV.png - screenshot QGIS 3.3 dev field calc (27.4 KB) salvatore fiandaca, 2018-09-03 02:40 PM

QGIS_322.png - screenshot QGIS 3.2.2 field calc (38.3 KB) salvatore fiandaca, 2018-09-03 02:41 PM

QGIS_2-18-23.png - screenshot QGIS 2.18.23 field calc (42.6 KB) salvatore fiandaca, 2018-09-03 02:45 PM

History

#1 Updated by Giovanni Manghi about 2 years ago

  • Category changed from Field calculator to Expressions

#2 Updated by Nyall Dawson about 2 years ago

  • Status changed from Open to Feedback

Try

line_interpolate_point ($ geometry, length($geometry) / 2)

$length converts to the project length setting, which is likely metres.

#3 Updated by salvatore fiandaca about 2 years ago

Nyall Dawson wrote:

Try

line_interpolate_point ($ geometry, length($geometry) / 2)

$length converts to the project length setting, which is likely metres.

I did a test and your expression works.

PS: in QGIS 2.18.23 changing units of measure (project properties -> degree map unit) $ length respects the change; QGIS 3.2.2 and DEV do not respect the change of units and the length is always in meters

#4 Updated by salvatore fiandaca about 2 years ago

salvatore fiandaca wrote:

Nyall Dawson wrote:

Try

line_interpolate_point ($ geometry, length($geometry) / 2)

$length converts to the project length setting, which is likely metres.

I did a test and your expression works.

errata corrige: it is necessary to change both ellipsoid settings in 'none / planimetric' and units of distance measurement in 'degrees'
thank you

PS: in QGIS 2.18.23 changing units of measure (project properties -> degree map unit) $ length respects the change; QGIS 3.2.2 and DEV do not respect the change of units and the length is always in meters

#5 Updated by Giovanni Manghi about 2 years ago

PS: in QGIS 2.18.23 changing units of measure (project properties -> degree map unit) $ length respects the change; QGIS 3.2.2 and DEV do not respect the change of units and the length is always in meters

filing a different ticket?

#6 Updated by Giovanni Manghi about 2 years ago

errata corrige: it is necessary to change both ellipsoid settings in 'none / planimetric' and units of distance measurement in 'degrees'
thank you

so... means this ticket can be closed?

#7 Updated by salvatore fiandaca about 2 years ago

Giovanni Manghi wrote:

errata corrige: it is necessary to change both ellipsoid settings in 'none / planimetric' and units of distance measurement in 'degrees'
thank you

so... means this ticket can be closed?

yes, it can be closed
thank you

#8 Updated by Nyall Dawson about 2 years ago

  • Resolution set to invalid
  • Status changed from Feedback to Closed

Also available in: Atom PDF