I've got a vector layer with points (representing customer locations) and another vector layer with a line (representing the coast line). I want to calculate a "smart" distance to coast. Specifically, I want to determine the shortest distance to the coastline within a specific range along a specific bearing.

For example, suppose a customer is located on a peninsula. At 0 degrees the distance is 1 mile to coast and at 180 degrees the distance to coast is 3 miles. In this case, I'm more interested in the distance at a bearing of 180 degrees. I run into many similar situations where the coastline weaves around so significantly that using a simple distance measurement yields unusable results for my purposes.

For each customer, I would store the bearing (in degrees) that I am wanting to use in this measurement.

Ideally, I'd like a function that allows me to find the shortest distance by specifying a bearing and a +/- range (in degrees), i.e., mypoint.min_distance_to_line_along_bearing(myline, 180, 15) ... which, in a perfect world, would return the shortest distance to the line in a bearing that is between 165 and 195 degrees.

I am using QGIS 2.8 on a Windows 7 PC. I hope this makes sense.

Your Answer

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

Browse other questions tagged or ask your own question.