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 6802125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:11:06+00:00 2026-05-26T19:11:06+00:00

Hey everyone I am building a website that needs to have the capability to

  • 0

Hey everyone I am building a website that needs to have the capability to store the physical location of a person and allow someone to search for other people within some radius of that location. For the sake of an example lets pretend it’s a dating website (it’s not) and so as a user you want to find people within 50 miles of your current location that meet some other set of search criteria.

Currently I am storing all of my user information in Azure Table Storage. However this is the first time I’ve ever attempted to create a geo-aware search algorithm so I wanted to verify that I am not going to waste my time doing something totally insane. To that end the idea for my implementation is as follows:

  1. Store the longitude and latitude for the users location in the Azure Table
  2. The PartitionKey for each entry is the state (or country if outside the US) that the person lives in
  3. I want to calculate the distance between the current user and all other users using the haversine equation. I’m assuming I can embed this into my LINQ query?
  4. Eventually I’d like to be able to get a list of all states/countries within the radius so I can optimize based on PartitionKey’s

Naturally this implementation strategy leads to a few questions:

  1. If I do the haversine equation in a LINQ query where is it being executed? The last thing I want is my WebRole to pull every record from azure storage to run this haversine equation on it within the application process
  2. Is the idea of doing this with Azure Storage totally crazy? I know there are solutions like MongoDB that have the capability to do spatial search queries built-in. I like the scalability of Azure but is there some better alternative I should investigate instead?

Thanks for the help in advance!

  • 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-26T19:11:07+00:00Added an answer on May 26, 2026 at 7:11 pm

    If you want the query to be fast against Azure tables, the query has to run against the partition key and row key. Also if you’re using LINQ to query Azure tables then you need to be careful about which functions you use. If the value can be calculated once for all row, LINQ will be clever and evaluate it before sending the query to AZT, however if it needs to be evaluated for each row, then you can only use those are those that Azure supports (which is a pretty short list).

    You might be able to make this work if you want to use a bounding square for your area not a bounding circle. Store latitude in the PartitionKey and longitude in the RowKey and have a query that looks like this:

    var query = from UserLocation ul
                in repository.All()
            where
                ul.PartitionKey.CompareTo(minimumLatitude) > 0
                && ul.PartitionKey.CompareTo(maximumLatitude) < 0
                && ul.RowKey.CompareTo(minimumLongitude) > 0
                && ul.RowKey.CompareTo(maximumLongitude) < 0
            select
                ul;
    

    This is probably not as clever as you were hoping for though. If this is not going to work for you, then you’ll need to look at other options. SQL Azure supports geospatial queries if you want to stay within the Microsoft family.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey everyone I have a basic search function here that allows me to search
Hey everyone, I'm working on a PHP application that needs to parse a .tpl
Hey everyone, I have a database result that returns from a method. I need
Hey everyone. I have an exe file that runs a console program that was
Hey everyone! I'm building a webapp in PHP that uses a MySql DB. What
Hey everyone... I'm not too familiar with PHP... but I have PHP code that
Hey everyone, I'm back and looking forward to more of your brilliance. I have
Hey everyone. The following is the code that I am using to play random
Hey everyone, here is the site in question: http://www.myvintagesecret.com/ I have a bunch of
Hey everyone, got a quick question that I can't seem to find anything about...

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.