I have bunch of location (Lat, Lng) data inside my database and let's assume it has the following columns:
Resort
Latitude
Longitude
I would like to define the radius of available resorts and I need to find the place on North West and South East. I need to find the most north-western resort and most south-eastern resort among those my aim is draw a rectangle which contains all of the places.
What would be the algorithm for that?
The table is stored inside SQL Server and I can use SP or Function here. Also, C# code would be helpful as well.
EDIT
I need to find a place on NW and SE to determine the rectangle. I need to first sort this out. I am not looking for a way to find places within that rectangle for now.
EDIT
Here is my imagination for what I am after (sorry for the awful drawing):
think this as a world map and the blue circles are resorts. I need to find the lat and lng of two places which I mark with a brown circle.
EDIT
@Damien_The_Unbeliever pointed out that I am on the wrong direction here. My aim is draw a rectangle which contains all of the places. And my question is telling another story.