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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:56:05+00:00 2026-06-14T17:56:05+00:00

I want to be able to display a Bing map in a Windows 8/Store

  • 0

I want to be able to display a Bing map in a Windows 8/Store app with an array of pushpins/waypoints at a zoom setting that will show every location, but no more than that – IOW, I want as much detail as possible while still showing all of the locations/coordinates.

I have this pseudocode:

public static int GetMapZoomSettingForCoordinates(List<String> coordinatesList)
{
    string furthestNorth = GetFurthestNorth(coordinatesList);
    string furthestSouth = GetFurthestSouth(coordinatesList);
    string furthestEast = GetFurthestEast(coordinatesList);
    string furthestWest = GetFurthestWest(coordinatesList);
    int milesBetweenNorthAndSouthExtremes = GetMilesBetween(furthestNorth, furthestSouth);
    int milesBetweenEastAndWestExtremes = GetMilesBetween(furthestEast, furthestWest);
    int greaterCardinalDistance = Math.Max(milesBetweenNorthAndSouthExtremes, milesBetweenEastAndWestExtremes);
    return GetZoomSettingForDistance(greaterCardinalDistance);
}

…but the “sticking point” (the hard part) are the “milesBetween” functions. Is there an existing algorithm for computing the miles between two coordinates?

I do realize this is a U.S.-centric bunch of code for now (miles vs. kilometers); that is, for now, as designed.

UPDATE

This is my new pseudocode (actual compiling code, but untested):

public static int GetMapZoomSettingForCoordinates(List<string> coordinatePairsList)
{
    List<double> LatsList = new List<double>();
    List<double> LongsList = new List<double>();
    List<string> tempList = new List<string>();

    foreach (string s in coordinatePairsList)
    {
        tempList.AddRange(s.Split(';'));
        double dLat;
        double.TryParse(tempList[0], out dLat);
        double dLong;
        double.TryParse(tempList[0], out dLong);
        LatsList.Add(dLat);
        LongsList.Add(dLong);
        tempList.Clear();
    }

    double furthestNorth = GetFurthestNorth(LatsList);
    double furthestSouth = GetFurthestSouth(LatsList);
    double furthestEast = GetFurthestEast(LongsList);
    double furthestWest = GetFurthestWest(LongsList);
    int milesToDisplay = 
        HaversineInMiles(furthestWest, furthestNorth, furthestEast, furthestSouth);
    return GetZoomSettingForDistance(milesToDisplay);
}

private static double GetFurthestNorth(List<double> longitudesList)
{
    double northernmostVal = 0.0;
    foreach (double d in longitudesList)
    {
        if (d > northernmostVal)
        {
            northernmostVal = d;
        }
    }
    return northernmostVal;
}

…I still don’t know what GetZoomSettingForDistance() should be/do, though…

UPDATE 2

This is “more better”:

public static int GetMapZoomSettingForCoordinates(List<Tuple<double, double>> coordinatePairsList)
{
    var LatsList = new List<double>();
    var LongsList = new List<double>();

    foreach (Tuple<double,double> tupDub in coordinatePairsList)
    {
        LatsList.Add(tupDub.Item1);
        LongsList.Add(tupDub.Item2);
    }

    double furthestNorth = GetFurthestNorth(LongsList);
    double furthestSouth = GetFurthestSouth(LongsList);
    double furthestEast = GetFurthestEast(LatsList);
    double furthestWest = GetFurthestWest(LatsList);
    int milesToDisplay =
        HaversineInMiles(furthestWest, furthestNorth, furthestEast, furthestSouth); 
    return GetZoomSettingForDistance(milesToDisplay);
}

UPDATE 3

I realized that my logic was backwards, or wrong, at any rate, regarding meridians of longitude and parallels of latitude. While it’s true that meridians of longitude are the vertical lines (“drawn” North-to-South or vice versa) and that parallels of latitude are the horizontal lines (“drawn” East-to-West), points along those line represent the North-South location based on parallels of latitude, and represent East-West locations based on meridians of longitude. This seemed backwards in my mind until I visualized the lines spinning across (longitude) and up and over (latitude) the earth, rather than simply circling the earth like the rings of Saturn do; what also helped get my perception right was reminding myself that it is the values of the meridians of longitude that determine in which time zone one finds themselves. SO, the code above should change to pass latitudes to determine furthest North and furthest South, and conversely pass longitudes to determine furthest East and furthest West.

  • 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-14T17:56:07+00:00Added an answer on June 14, 2026 at 5:56 pm

    You can use the Haversine formula to compute the distance along the surface of a sphere.

    Here’s a C++ function to compute the distance using the Earth as the size of the sphere. It would easily be convertible to C#.

    Note that the formula can be simplified if you want to just find the distance either latitudinally or longitudinally (which it sounds like you are trying to do).

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

Sidebar

Related Questions

I want to be able to display child rows upon load. Right now I
I want to be able to display links based on cell values. So if
I want to be able to take an image that i have already captured
I want to be able to display some simple chunks of HTML in my
a)In my app I want to be able to save files to a directory
We're in the process of writing an app that has 4 tabs: Map, People,
I want to be able to compare two text string and display the difference
I have the requirement in my WP7 application to display pushpins on a bing
I'm using LaTeX and BibTeX for an article, and I want to able to
Want to be able to provide a search interface for a collection of objects

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.