If you want to know the distance of the route, you can use the Google Maps Distance Matrix API.
This API returns for example the time and duration between points.
Example: Distance between SP - RJ
Using your own coordinates.
https://maps.googleapis.com/maps/api/distancematrix/json?units=metric&origins=-23.562984,-46.654261&destinations=-22.951669,-43.210466&key=KEY_CODE
Return:
{
"destination_addresses" : [ "Christ the Redeemer Statue Rio, Rio de Janeiro - RJ, Brasil" ],
"origin_addresses" : [
"Alameda Rio Claro, 313 - Bela Vista, São Paulo - SP, 01332-010, Brasil"
],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "449 km",
"value" : 449025
},
"duration" : {
"text" : "5 horas 45 minutos",
"value" : 20689
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
Result: 5h 45min - 449 km
You just want to know how to calculate the distance between two coordinates or you want to know how to do everything that talks there in the question?
– ramaral
And what have you done so far? Are you using any API or are you using native GPS? Could you give details?
– Guilherme Nascimento
So, ramaral, I need to know if the distance between the two coordinates is close, to validate if the user is in place. It’s like this: XYZ event on Unnamed Street, n° 10, I want to get the user’s coordinate and know if he’s on site. Guilherme, until now I only have the interface (mounted through Mysql data) just need to implement this function in the existing button, but as I am new in mobile development, I have no idea how to start hahaha I made the entire application using tutorials.
– Jhonatan Pereira
Well, I was able to obtain user longitude and latitude (-22.75678733; -42.88711433) through this link: http://stackoverflow.com/questions/6567171/how-to-get-users-gps-coordinatdinates-by-clicking-a-button and now how do I know the distance between that coordinate and any other? Instead of longitude and latitude as in the link above, you can capture an address (street name and number )?
– Jhonatan Pereira
You do not need to keep editing the posts and marking them as solved. Just accept the answer. Please read the "TOUR" page of the site
– EProgrammerNotFound