Calculer la distance entre son domicile et un point donnée dans une textbox

Bonjour à tous

Je sollicite votre aide concernant une application que j'essaye de développer avec AppInventor. Cette application permettra de calculer notre salaire en respectant scrupuleusement les condtions de déplacement de l'entreprise pour laquelle je travail. ma question est la suivante:
Dans un fichier csv se trouve une liste de site sur lesquel on travail, un textbox sert a afficher des Km

Est il possible que ( en stockant biensure l'adresse du domicile quelque part) je puisse faire en sorte que je selectionne le site il me donne les km domicile /site ?

Pourriez-vous m'aider à réaliser ceci ?

Un grand merci a vous et bonne soirée


Welcome Christian

1.) This tutorial example determines driving distance HOW TO: Use the Navigate control using the MIT Navigate Map control. Use this example to calculate driving distance between two addresses or two pairs of geocoordinates . Documentation is Maps

2.) These two examples determine distance between two geocoordinates using a point to point distance calculation (not driving distance). The depend on having access to the location coordinates, not street address.

  • using the Map component and a Marker you can use these two Blocks to calculate
    the distance between them in meters. Convert to whatever units you require.

  • using a Great Circle distance algorithm

    The Blocks with 6371 provides a result in metric units, the Blocks using 3959 results in English units.

There are many other options:

The API for the Route service is at: Calculate a Route - Bing Maps | Microsoft Learn. It can return driving distances and routes plotted between up to 25 waypoints.

Conditions for use are at, but it's basically free for educational/non-profit use.


1 Like

Hello good day and thanks for the algorithm, can you help me with this?

can place the image but inside the procedure where can i get the math block that its with an X before the 3959 and convert blocks

I only have this displayed

thanks a lot

I was able to review this programming, never the less the equation result is not correct

I would really appreciate if you can help me out

thanks again

For complex formulas, there are two things that help to build them ...

  • Use the right click menu on your math blocks to choose External Inputs instead of Inline Inputs
  • Use the Blue box to add more sockets to the multiplication block.

(A totally irrelevant example)

Also, when using AI2 trigonometry, check the tool tips of the blocks to ascertain what they use (degrees vs radians) and make sure that is what you are feeding them.

1 Like


These two Procedures are mathematical identical; one version

uses primarily external inputs. It is a copy of the Blocks you use as an example.

The other version uses internal inputs

and may help you use them correctly.

Both correctly calculate distanceBetweenLocationsMiles using a Great Circle algorithm.

A developer uses them with procedures_callreturn to calculate the distance from the first location to the second in miles.


Awesome, thanks a lot

1 Like

Yesterday, I saw about using haversine formula using mit blocks but today I am not able to find it.

Well, it was @SteveJG who posted it...


1 Like