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

  • Home
  • SEARCH
  • 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 9174563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:46:34+00:00 2026-06-17T16:46:34+00:00

I am not looking for any code, just advice on a particular aspect of

  • 0

I am not looking for any code, just advice on a particular aspect of a project.

I have an XML file that contains coordinates and the building name and I want to be able to capture the coordinates of where the person is (I’m going to be creating a mobile application so this is ok).

Is the senario above possible using a LINQ statement in C#? If so, is it possible to get a close match? i.e. if the person isn’t exactly in the coordinates, show him/her the nearest match.

I’m NOT specifically looking for any code just any hints, tips, or advanced tutorials on LINQ would be helpful.

Thanks

  • 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-06-17T16:46:35+00:00Added an answer on June 17, 2026 at 4:46 pm

    You can use System.Device.Location.GeoCoordinate class for this

    List<GeoCoordinate> listTakenFromXml = ......
    double lat = ......
    double lon = ........
    var nearest = new GeoCoordinate(lat, lon).NearestPoint(listTakenFromXml);
    

    public static class SoExtensions
    {
        public static GeoCoordinate NearestPoint(this GeoCoordinate loc, IEnumerable<GeoCoordinate> coords)
        {
            GeoCoordinate minLoc = null;
            double minDist = double.MaxValue;
            foreach (var c in coords)
            {
                var dist = c.GetDistanceTo(loc);
                if ( dist < minDist)
                {
                    minDist = dist;
                    minLoc = c;
    
                }
            }
            return minLoc;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Edit: Not looking for anyone to write code for me, just looking for advice
Looking for some practical advice here and any experiences people have had in a
I'm new to JQuery. I'm not looking necessarily for code -- just someone to
I have a code-base of legacy C/C++ code, which contains lots of functions that
So I've been looking around for days now and I can not find any
I'm not looking to harvest information, I'm just trying to create a way to
I am not looking for the answer here but just how to find the
edit: I'm not looking for you to debug this code. If you are familiar
I have a problem with Hibernate Validator 3.1.0.GA not looking up custom validation messages
We have some standalone devices that will send XML messages to arbitrary processing software

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.