Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6949599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:58:33+00:00 2026-05-27T13:58:33+00:00

I have bunch of location (Lat, Lng) data inside my database and let’s assume

  • 0

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):

enter image description here

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:58:34+00:00Added an answer on May 27, 2026 at 1:58 pm

    To draw a rectangle where all the resorts fit inside here is the full example:

    create table #testing (
    Resort varchar(20),
    Longitude int,
    Latitude int
    )
    
    insert into #testing values ('Res 1', 10, 20)
    insert into #testing values ('Res 2', -12, 30)
    insert into #testing values ('Res 3', 3, -122)
    insert into #testing values ('Res 4', 120, 120)
    insert into #testing values ('Res 5', -2, 230)
    insert into #testing values ('Res 6', 32, -2)
    
    select
        min(Longitude) [Min Longitude],
        max(Longitude) [Max Longitude],
        min(Latitude) [Min Latitude],
        max(Latitude) [Max Latitude],
        convert(varchar, min(Longitude)) + "," + convert(varchar, max(Latitude)) [NW],
        convert(varchar, max(Longitude)) + "," + convert(varchar, min(Latitude)) [SE]
        from #testing
    
    drop table #testing
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bunch of location data (longitude and latitude pairs) sitting in a
I have written a bunch of unit tests inside VS2010 Express and tests being
I have a bunch of data on Dutch individuals that I would like to
I have a bunch of results from the Database that I keep in a
I have a bunch of events with their location being pulled from the db
I have a bunch of collections in my MongoDB database. To illustrate what I'm
I have a textarea that accepts a bunch of data. I then submit it
Lets say I have to copy a bunch of files from one location to
I have a bunch of lines that I'd like to split into two columns,
I have bunch of strings, some of which are fairly long, like so: movie.titles

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.