I am a new user of QGIS and had this exact same questionDespite the @Kazuhito's answer that solves the OP's problem, excepthere is my workflow that I also wantedincludes the calculation of distance in meters between the 1one point and the other 2two points. Kazuhito's answer solves the OP's problem I believe, but here's my workflow in case any other new users find it helpful:
Use case
I have a csvCSV file with the coordinates of 3three points in the EPSG:4326 coordinate system. Point 2 is my reference coordinate. I want to find the distance between point 2 and points 1 and 3. I also want to find the angle between the line from points 3 to 2, and the line from point 1 to 2:
Workflow
- Insert new text delimited layer from csvCSV file
- Convert csvCSV layer to shapefile
- Use 'Reproject layer' tool in Processing Toolbox to reproject to a suitable Projected Coordinate System
- Duplicate the
reprojected layer
twice. In 1 copy, keep only point 2 in the Attribute table, and delete the rest. In the other copy, keep only points 1 and 3. - Use the 'Distance to nearest hub (line to hub)' tool in the Processing toolbox. Set source points later to the
reprojected points 1 and 3
layer, and target hub layer toreprojected point 2
layer. This should create a newHub distance
layer. - In the Attribute table of your
Hub distance
layer, toggle on the edit mode, and open the Field Calculator, inputting the following - Now for each of your lines in the
Hub distance
layer, you will have an azimuth under the Angle attribute. The absolute difference between the 2 azimuths will give the angle between the 2 lines.
Links to other questions and solutions I used: calculate angle between two lines