Newbie question: calculating distance between 2 text addresses using Bing Maps API

LMMMMM 1 Reputation point
2022-09-01T17:14:29.327+00:00

C# .Net Core web site.

Users enter from and to address

I've looked at the documentation and it looks like the API input is in coordinates.

Do I need to find another API to convert text address to a coordinate or is there a converter API in Bing Maps?

Suggestions or alternate solutions are appreciated.

Windows Maps
Windows Maps
A Microsoft app that provides voice navigation and turn-by-turn driving, transit, and walking directions.
253 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dillon Silzer 56,681 Reputation points
    2022-09-02T03:12:01.493+00:00

    Hi @LMMMMM

    You can use the Find a Location by Query to get the longitude and latitude of two different locations:

    https://learn.microsoft.com/en-us/bingmaps/rest-services/locations/find-a-location-by-query

    http://dev.virtualearth.net/REST/v1/Locations/{locationQuery}?includeNeighborhood={includeNeighborhood}&maxResults={maxResults}&include={includeValue}&key={BingMapsKey}

    Then you can do simple math to get the distance between the two geocodes.

    If you want to know the distance via a driving, transit or other route option, use the Rest Route API:

    https://learn.microsoft.com/en-us/bingmaps/rest-services/routes/calculate-a-route

    http://dev.virtualearth.net/REST/V1/Routes/Driving?o=xml&wp.0=Seattle,WA&wp.1=Portland,OR&key={BingMapsKey}

    --------------------------------------------------------

    If this is helpful please accept answer.

    1 person found this answer helpful.
    0 comments No comments