Consider the following:
- Point A
DbGeography
(office address) - Point B
DbGeography
(customer's address outside of office's service area) - Polygon C
DbGeography
(office's service area)
Using the above points and polygon, how can I find the closest distance of B to C's edge? I assume that first I need to find the line between A and B, then find where the line intersects C (= D) and then calculate the distance from D to B?
Since my usage of SQL Server's spatial capabilities is limited and I'm using Entity Framework, I'm not sure how to express that in code. I also assume that I'd have to use SqlGeography
for this since DbGeography
is kind of limited. I'd probably end up writing an extension to DbGeography
.
I'd appreciate any suggestions (would love code examples) of how I can accomplish the above task.