Skip to main content
deleted 93 characters in body
Source Link
Taras
  • 34k
  • 4
  • 73
  • 148

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:   

post workflow image

Workflow

  1. Insert new text delimited layer from csvCSV file
  2. Convert csvCSV layer to shapefile
  3. Use 'Reproject layer' tool in Processing Toolbox to reproject to a suitable Projected Coordinate System
  4. 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.
  5. 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 to reprojected point 2 layer. This should create a new Hub distance layer.
  6. In the Attribute table of your Hub distance layer, toggle on the edit mode, and open the Field Calculator, inputting the following Field calculator
  7. 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

I am a new user of QGIS and had this exact same question, except that I also wanted the distance in meters between the 1 point and the other 2 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 csv file with the coordinates of 3 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:  post workflow image

Workflow

  1. Insert new text delimited layer from csv file
  2. Convert csv layer to shapefile
  3. Use 'Reproject layer' tool in Processing Toolbox to reproject to a suitable Projected Coordinate System
  4. 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.
  5. 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 to reprojected point 2 layer. This should create a new Hub distance layer.
  6. In the Attribute table of your Hub distance layer, toggle on the edit mode, and open the Field Calculator, inputting the following Field calculator
  7. 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

Despite the @Kazuhito's answer that solves the OP's problem, here is my workflow that also includes the calculation of distance in meters between one point and other two points.

Use case

I have a CSV file with the coordinates of three 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: 

post workflow image

Workflow

  1. Insert new text delimited layer from CSV file
  2. Convert CSV layer to shapefile
  3. Use 'Reproject layer' tool in Processing Toolbox to reproject to a suitable Projected Coordinate System
  4. 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.
  5. 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 to reprojected point 2 layer. This should create a new Hub distance layer.
  6. In the Attribute table of your Hub distance layer, toggle on the edit mode, and open the Field Calculator, inputting the following Field calculator
  7. 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

Source Link

I am a new user of QGIS and had this exact same question, except that I also wanted the distance in meters between the 1 point and the other 2 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 csv file with the coordinates of 3 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: post workflow image

Workflow

  1. Insert new text delimited layer from csv file
  2. Convert csv layer to shapefile
  3. Use 'Reproject layer' tool in Processing Toolbox to reproject to a suitable Projected Coordinate System
  4. 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.
  5. 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 to reprojected point 2 layer. This should create a new Hub distance layer.
  6. In the Attribute table of your Hub distance layer, toggle on the edit mode, and open the Field Calculator, inputting the following Field calculator
  7. 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