GPS coordinates
Posted: Wed Dec 12, 2018 11:19 am
Hi all !
Is it possible to get GPS coordinates by address ?
Is it possible to get GPS coordinates by address ?
www.FiveTechSoft.com
https://forums.fivetechsoft.com/
Code: Select all
<script type="text/javascript">
var dir1 = "5th ave, new york";
var google_url = "http://maps.googleapis.com/maps/api/geocode/json?address=";
var sensor = "&sensor=false";
var resultado;
function myFunction(){
$.getJSON(
google_url+dir1+sensor,
function(result){
$( "body" ).append( "Latitude: " + JSON.stringify(result.results[0].geometry.bounds.northeast.lat) )
$( "body" ).append( "Longitude: " + JSON.stringify(result.results[0].geometry.bounds.northeast.lng) )
});
}
Code: Select all
#include "FiveWin.ch"
function Main()
local cGoogleURL := "http://maps.googleapis.com/maps/api/geocode/json?address="
local cAddress := "5th ave, new york"
local cSensor := "&sensor=false"
local cKey := "&key=" + MY_API_KEY
MsgInfo( WebPageContents( cGoogleURL + cAddress + cSensor + cKey ) )
return nil
Code: Select all
#include <fivewin.ch>
function Main()
local cGoogleURL := "https://nominatim.openstreetmap.org/search?format=json&q="
local cAddress := "5th ave, new york"
local aReturn, i, cTxt := ""
aReturn := hb_jsonDecode( WebPageContents( cGoogleURL + cAddress) )
if !empty(aReturn)
for i:=1 to len(aReturn)
cTxt += aReturn[i,"display_name"] + e"\r\n"
cTxt += aReturn[i,"lat"]+" "+aReturn[i,"lon"] + e"\r\n" + e"\r\n"
next
else
cTxt:="not found"
endif
MsgInfo(cTxt)
return nil
Code: Select all
#include "FiveWin.ch"
function Main()
local cGoogleURL := "https://nominatim.openstreetmap.org/search?format=json&q="
local cAddress := "5th ave, new york"
local aReturn, i, cTxt := ""
// aReturn := hb_jsonDecode( WebPageContents( cGoogleURL + cAddress) ) // *** Change this ***
aReturn := WebPageContents( cGoogleURL + cAddress)
hb_jsondecode( aReturn, @aReturn )
if !empty(aReturn)
for i:=1 to len(aReturn)
cTxt += aReturn[i,"display_name"] + e"\r\n"
cTxt += aReturn[i,"lat"]+" "+aReturn[i,"lon"] + e"\r\n" + e"\r\n"
next
else
cTxt:="not found"
endif
MsgInfo(cTxt)
return nil