Microsoft’s Geospatial Capabilities

Abhishek Mandal 21 Reputation points
2020-04-30T16:45:40.93+00:00

I am using Microsoft’s Graph API as the main database for our application. Need to implement data sorting on basic of geolocation distance.
Can the Microsoft team help me in implementing the same or suggest any solution to implement a similar requirement?

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
587 questions
{count} votes

Accepted answer
  1. Anonymous
    2020-05-11T15:36:41.053+00:00

    Unless your data has the distance information in it, which I suspect is not the case, you would have to calculate the distance and sort in code after the query. If you are using the Azure Maps Web SDK in your application you can use the atlas.math.getDistanceTo function to calculate the straight line distance to each location from an origin point. https://learn.microsoft.com/en-us/javascript/api/azure-maps-control/atlas.math?view=azure-maps-typescript-latest#getdistanceto-position---point--position---point--string---distanceunits-

    If you want the straight line distance, without using Azure Maps, or in any programming language, the Haversine formula is the calculation for this: https://rosettacode.org/wiki/Haversine_formula

    If you want driving distances instead of straight line distances, the Azure Maps Route matrix service could be used to calculate this. https://learn.microsoft.com/en-us/rest/api/maps/route/postroutematrix

    Once you have distances for each location, sorting your results would be the same as sorting on any number value in your data. How this would be done would depending on the programming language you are using.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful