Source language: Translate to:

converting longtitude tlatitude to location name

General questions about NeoBook

Moderator: Neosoft Support

converting longtitude tlatitude to location name

Postby yanzco » Fri Feb 03, 2017 8:04 am

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
yanzco
 
Posts: 178
Joined: Sun Jul 20, 2014 4:07 am

Re: converting longtitude tlatitude to location name

Postby Gaev » Fri Feb 03, 2017 10:28 am

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.
User avatar
Gaev
 
Posts: 3738
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: converting longtitude tlatitude to location name

Postby virger » Fri Feb 03, 2017 4:08 pm

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
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 524
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: converting longtitude tlatitude to location name

Postby yanzco » Fri Feb 03, 2017 10:03 pm

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
yanzco
 
Posts: 178
Joined: Sun Jul 20, 2014 4:07 am

Re: converting longtitude tlatitude to location name

Postby virger » Sat Feb 04, 2017 6:25 am

COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 524
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: converting longtitude tlatitude to location name

Postby yanzco » Sat Feb 04, 2017 11:20 pm

thank you virger for the help.. :D
yanzco
 
Posts: 178
Joined: Sun Jul 20, 2014 4:07 am

Re: converting longtitude tlatitude to location name

Postby virger » Sun Feb 05, 2017 6:36 am

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
COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 524
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: converting longtitude tlatitude to location name

Postby yanzco » Sun Feb 05, 2017 7:44 pm

yes this is much faster.. thanks again virger..
yanzco
 
Posts: 178
Joined: Sun Jul 20, 2014 4:07 am


Return to General NeoBook Discussions

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron