question

AbhishekMandal-7346 avatar image
0 Votes"
AbhishekMandal-7346 asked ·

Microsoft’s Geospatial Capabilities

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
· 1
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Azure Maps has not yet migrated to Microsoft Q&A yet. This service will be migrated from MSDN to Microsoft Q&A over the next couple months. When we do move, we will make an announcement on MSDN.


I apologize for the inconvenience. Meanwhile, please post your question on MSDN forum and our experts will help you there.


0 Votes 0 ·

1 Answer

$$ANON_USER$$ avatar image
1 Vote"
$$ANON_USER$$ answered ·

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://docs.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://docs.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 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Looks like I was signed in with the wrong account when I responded to this question previously.

2 Votes 2 ·