3

I have a dataset of points (longitude, latitude) and I used QGIS get a Voronoi diagram of these points. Each point has an azimuth and a wedge width that I also managed to visualize in QGIS.

VoronoiDiagram

As you can see, each point is in a polygon made by Voronoi. I wanted to know if there is a way to find which side of the polygon intersects the two lines formed by the wedge width. For example, in the following picture it would be the two sides in blue.

PolygonSides

1

A bit involved way, but anyway...

(1) Convert Voronoi polygons to lines (Polygons to lines tool)

(2) Convert Voronoi lines to segments (Explode lines tool)

(3) Extract by expression tool on the Exploded layer from above (2)

intersects( 
   make_line(
     project(
       geometry(get_feature('points', 'fid', "fid")), 
       1000, radians(wedge_azimuth - 0.5 * wedge_width)) , 
     geometry(get_feature('points', 'fid', "fid")), 
     project(
       geometry(get_feature('points', 'fid', "fid")), 
       1000, radians(wedge_azimuth + 0.5 * wedge_width))) , 
   $geometry)

where:

  • 'points' shall be replaced by your points layer name.
  • fid is the id field. Usually Voronoi tools inherit id field from the point data, so checking 'fid' against "fid" will find the point- Voronoi pairs.
  • wedge_azimuth is your wedge azimuth field name
  • wedge_width is your width field name
  • 1000 is the length of the line extending out from the points. It is probably too much for you as your data is on geographical - latlong coordinates. Very small number, say 0.001 would be more appropriate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.