How to send a distance to storage account by azure maps using function app

surya chakravarthy 41 Reputation points
2022-12-26T06:48:38.277+00:00

I want to find the distance between two points and the calculated distance need to store it in storage account.
I want to do that with serverless. So I had been choosen function app. can you help me with my requirement plz.

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

Accepted answer
  1. rbrundritt 15,386 Reputation points Microsoft Employee
    2022-12-26T18:49:20.863+00:00

    Which type of storage solution are you planning to use? https://learn.microsoft.com/en-us/azure/storage/common/storage-introduction

    The basic flow for your solution would be as follows:

    1. Get the two points you want to calculate the distance between. Is this input into the service? Stored in some file you want to process?
    2. If the points are addresses, geocode them using the v2 geocoding service in Azure Maps: https://learn.microsoft.com/en-us/rest/api/maps/search-v2/get-geocoding?tabs=HTTP
    3. Once you have coordinates, decide on the type of distance you want. If you want straight line distances, simply calculate these using the Haversine formula: https://rosettacode.org/wiki/Haversine_formula If you want distances along the roads, use the Azure Maps routing service or route matrix service (if you are processing a lot of points at once). https://learn.microsoft.com/en-us/rest/api/maps/route/get-route-directions?tabs=HTTP https://learn.microsoft.com/en-us/rest/api/maps/route/post-route-matrix?tabs=HTTP
    4. Take the distances, convert the units if needed as depending on which of the above you methods you use, you will likely get KM or meter distances.
    5. Connect to your storage account and upload your distances (how exactly you would do this depends on which storage method you are using).

    Use the SDKs to make it easier to make requests to the REST services:

    https://learn.microsoft.com/en-us/azure/azure-maps/rest-sdk-developer-guide

    https://learn.microsoft.com/en-us/dotnet/api/overview/azure/storage?view=azure-dotnet

    0 comments No comments

0 additional answers

Sort by: Most helpful