0

In a previous employment, I needed to display a "Distance to stockist" on our website. It would get your current co-ordinates (from a postcode or HTML5 geolocate) and then display a list of nearby stockists.

Because we only had about 150 stockists in our database, what I could do was:

  • Get each stockist from the database
  • Work out the distance to that stockist
  • Order the list by distance and display it

And due to the small numbers, it was quick and worked well.

However, I'm undertaking something similar now but instead of having 150 stockists to check against, I'm working with a much larger dataset - let's call it somewhere between 10,000 and 20,000 different locations.

I don't feel I can use the same approach because of the time it would take to retrieve the data, calculate the distance to each, and sort it.

So what can I do?

Information I have to me is:

  • The user's latitude/longitude co-ordinates
  • The latitude/longitude of each location
  • The Northings / Eastings of each location

I'm developing in C# with SQL Server 2014 Express. A solution in either C# or T/SQL will be fine.


I have just come across https://msdn.microsoft.com/en-gb/library/ff929109.aspx which I think will do what I need.

closed as off-topic by PolyGeo Oct 16 '18 at 21:07

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "When seeking help to debug/write/improve code always provide the desired behavior, a specific problem/error and the shortest code (as formatted text, not pictures) needed to reproduce it in the question body. Providing a clear problem statement and a code attempt helps others to help you." – PolyGeo
If this question can be reworded to fit the rules in the help center, please edit the question.

-1

I found this video, which has done just what I wanted to do.

https://msdn.microsoft.com/en-gb/data/hh859721.aspx

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

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