PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → GPS - Lat Lon Return Endereco
GPS - Lat Lon Return Endereco
Débuté par adrianoboller, 24 nov. 2014 13:08 - Aucune réponse
Membre enregistré
3 657 messages
Popularité : +175 (223 votes)
Posté le 24 novembre 2014 - 13:08
// Summary: <specify the procedure action>
// Syntax:
//[ <Result> = ] GPS_LatLonRetEndereco (<Latitude>, <Logitude>)
//
// Parameters:
//Latitude: <specify the role of Pos>
//Logitude: <specify the role of Logitude>
// Return Value:
// ANSI string: // None
//
// For instance:
// Indicate an example.
//
Procedure GPS_LatLonRetEndereco(LOCAL Latitude, LOCAL Logitude)

Inicio , Final is int
Endereco, Numero, RetornaEndereco is string = ""


HTTPRequest("http://maps.googleapis.com/maps/api/geocode/json?latlng="+Latitude+","+Logitude+"&sensor=true")
Return_Json is string = HTTPGetResult(httpResult)

//Pega o endereço
//formatted_address" : "
Inicio = PositionOccurrence(Return_Json, "formatted_address", firstRank, IgnoreCase ) + 22
//geometry
Final = PositionOccurrence(Return_Json,"geometry", firstRank, IgnoreCase ) - 12
//Pega endereço
Return_Json = Middle(Return_Json, Inicio, ((Final - Inicio)))
//Remove acentos
Endereco = NoAccent(Return_Json)


//Pega o numero
//Primeiro valor apos a primeira virgula
Inicio = PositionOccurrence(Endereco, ", ", firstRank, IgnoreCase ) + 1
//Final do numero do endereço
Final = PositionOccurrence(Endereco, " - ", firstRank, IgnoreCase )
//Remove acentos
Numero = Middle(Endereco, Inicio, Final - Inicio)

RetornaEndereco = Endereco &", "& Numero

RESULT(RetornaEndereco)