Page 1 of 1

converting longtitude tlatitude to location name

PostPosted: Fri Feb 03, 2017 8:04 am
by yanzco
does anyone have tried it?

i manage to have neobook read a list of longtitude and latitude..
now i want to be able to convert this longtitude and latitude to the location name...
reverse geocoding...


one guy said..

You can use GOOGLE MAP API

http://maps.googleapis.com/maps/api/geo ... ensor=true

Make a http request and the result will contain array of object which will contain all required data

Code: Select all
var xmlHttp = new XMLHttpRequest();
    xmlHttp.open( "GET", "http://maps.googleapis.com/maps/api/geocode/json?latlng=13.02965,80.2376969&sensor=true", false );
    xmlHttp.send( null );
    console.log(xmlHttp.responseText);


Just run the above lines in your console to see the list of returned objects


but how?.. how can i use jscript in neobook? badly need help

Re: converting longtitude tlatitude to location name

PostPosted: Fri Feb 03, 2017 10:28 am
by Gaev
yanzco:

how can i use jscript in neobook?

Read the Help file about the following NeoBook commands ...

BrowserExecScript
Call (code in Function Library can be JScript, VBScript or NeoBook commands)

You can also create your javascript inside an HTML document ... and run the document inside a Web Browser object.

By the way, the http refrenced in your post returns a JSON object (with key/value pairs) ... so, whatever method you deploy, you will also need to learn how to extract the value associated with the particular key you are interested in.

Re: converting longtitude tlatitude to location name

PostPosted: Fri Feb 03, 2017 4:08 pm
by virger
And this maybe help you
Code: Select all
setvar "[LatLng]" "13.02965,80.2376969"
InternetGet "http://maps.googleapis.com/maps/api/geocode/json?latlng=13.02965,80.2376969&sensor=true" "[Res]" "HideProgress+Async"

And then use "Res" Var

Re: converting longtitude tlatitude to location name

PostPosted: Fri Feb 03, 2017 10:03 pm
by yanzco
virger wrote:And this maybe help you
Code: Select all
setvar "[LatLng]" "13.02965,80.2376969"
InternetGet "http://maps.googleapis.com/maps/api/geocode/json?latlng=13.02965,80.2376969&sensor=true" "[Res]" "HideProgress+Async"

And then use "Res" Var



@virger
this is exactly what i needed!

but are there limits how many times you can get info?
i mean, if i have a list of Latitude Longitude, and keep "getting" the location let's say, every 30 seconds for the next 12 hours
so, if i have 100 latlong...
60/30 = 2 ( 2 times every minute )
2*60 = ( 120 times every hours )
120*12 = ( 1440 times in 12 hours )

1440 * 100 = ( 144,000 times of "getting" for all 100 locations in 12 hours )


edit: now i made a test..
i will keep looping a list of LatLong and save the count.. and check if what happens for the wholeday...
edit: currently running the test... currently on the 116th count...



now i need a way to read he JSON file ( value stored in Res )
and split the data to different variables.. :o

Re: converting longtitude tlatitude to location name

PostPosted: Sat Feb 04, 2017 6:25 am
by virger

Re: converting longtitude tlatitude to location name

PostPosted: Sat Feb 04, 2017 11:20 pm
by yanzco
thank you virger for the help.. :D

Re: converting longtitude tlatitude to location name

PostPosted: Sun Feb 05, 2017 6:36 am
by virger
Try this button, in the previus "pub"
Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=3
Name=BtFastWay
X=694
Y=19
W=75
H=28
Anchor=0
Text=FastWay
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=... TO READ OR CHANGE¶setvar "[Lat]" "7.7797597"¶setvar "[Lng]" "125.0099085"¶¶setvar "[LatLng]" "[Lat],[Lng]"¶InternetGet "http://maps.googleapis.com/maps/api/geocode/json?latlng=[LatLng]&sensor=true" "[Res]" "HideProgress"¶¶StrReplace "[Res]" "[#32]" "" "[Res]" ""¶¶StrParse "position1,position2,province,region,location" "," "[Var]" "[Ps]"¶setvar "[Sep]" "[#13][#10]"¶setvar "[N]" "1"¶setvar "[Tx]" ""¶ListBoxSize "LsRes" "[Sz]"¶loop "5" "[Sz]" "[L]"¶    ListBoxGetItem "LsRes" "[L]" "[Lin]"¶    SearchStr "long_name" "[Lin]" "[Ps]" ""¶    ifex "[Ps]>0 AND [N]<5"¶        strparse "[Lin]" "[#34]" "[Dt]" "[Ps]"¶        ... ONLY TO SHOW¶        setvar "[Tx]" "[Tx][Var[N]] = [#34][Dt4][#34][Sep]"¶        ... CREATE THE VARIABLE THAT YOU NEED¶        setvar "[[Var[N]]]" "[Dt4]"¶        math "[N]+1" "" "[N]"¶    endif¶¶    SearchStr "formatted_address" "[Lin]" "[Ps]" ""¶    if "[Ps]" ">" "0"¶        strparse "[Lin]" "[#34]" "[Dt]" "[Ps]"¶        ... ONLY TO SHOW¶        setvar "[Tx]" "[Tx][Var[N]] = [#34][Dt4][#34][Sep]"¶        ... CREATE THE VARIABLE THAT YOU NEED¶        setvar "[[Var[N]]]" "[Dt4]"¶        exitloop¶    endif¶endloop¶... IT'S YOUR OPTION¶deletearray "[Dt]" "All"¶deletearray "[Var]" "All"¶clearvariables "[sep],[n],[l],[ps],[sz],[Res],[lin],[lat],[lng],[latlng]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=10


Enjoy..
Tkx For ReadMe

Re: converting longtitude tlatitude to location name

PostPosted: Sun Feb 05, 2017 7:44 pm
by yanzco
yes this is much faster.. thanks again virger..