Asmaa AlHammadi
Posts: 0
Joined: Tue May 12, 2015 12:56 pm

display directions beftween two places

Hello,

I found a java script that shows directions on the map

var sourceAddress = Apperyio("from").val();
var destinationAddress = Apperyio("to").val();
displayDirections(sourceAddress, destinationAddress, map);

from this tutorial https://devcenter.appery.io/tutorials...

"from" and "to" are buttons
I want to change them,
because in my map, I display a location by using set storage and set property for the longitude and latitude on the map (first location)
Also, the map shows current location (second location)

I want to show directions between these two locations (the first location that + current location)
How can I do that?

I hope someone could understand me,
thank you,

Asmaa

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

display directions beftween two places

Hi Asmma -

You will need to assign your storage variables to variables 'sourceAddress' and 'destinationAddress' and pass them as parameters into function 'displayDirections'.

Here is more information how to work with Storage API: https://devcenter.appery.io/documenta...

Asmaa AlHammadi
Posts: 0
Joined: Tue May 12, 2015 12:56 pm

display directions beftween two places

thank you for your explanation
but for appearing the first and second locations on map, I use set storage and set property for longitude and latitude.
so, I used two variables to each location (one for longitude and one for latitude)

can you please explain to me in more details? because I am new to appery and this is my first app

thank you

Asmaa AlHammadi
Posts: 0
Joined: Tue May 12, 2015 12:56 pm

display directions beftween two places

I change the code
var sourceAddress = Apperyio("$['temp']['temp2']").val();
var destinationAddress = Apperyio("$['currentlat']['currentlng']").val();
displayDirections(sourceAddress, destinationAddress, map);

but it doesnt work
I think there is a mistake

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

display directions beftween two places

Hello Asmma,

You incorrect use storage variable. Please change JS to something like:

prevar sourceAddress = Apperyio.storage.temp.get("$["+i+"]['temp2']");
var destinationAddress = Apperyio.storage.currentlat.get("$["+i+"]['currentlng']");
displayDirections(sourceAddress, destinationAddress, map);/pre

here variable "i" should be defined

Asmaa AlHammadi
Posts: 0
Joined: Tue May 12, 2015 12:56 pm

display directions beftween two places

Hi Sergiy,

I tried the code but it doesn't work
how can I define the "i"?

temp and temp2 are variables that appears on the map once I open the page, after that the current location appears once I click on the button, and currentlng + currentlat are current location variables.

thanks for your help

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

display directions beftween two places

Asmaa, I just changed your code ;) Could you provide JS code where all variables are visible? I mean I need to know all location variables and their values.

Asmaa AlHammadi
Posts: 0
Joined: Tue May 12, 2015 12:56 pm

display directions beftween two places

thank you,

first, I create this page
https://devcenter.appery.io/tutorials...

but, instead of users, I put places name, location, longitude, and latitude
after that I put a button that negative to the second page "map" to display the selected place on the map

Image

I use set storage from first page for the longitude and latitude , and set property to the map to display the longitude and latitude ( the variable for longitude: temp2, latitude:temp)

after that I use geolocation service to display the current location
https://devcenter.appery.io/tutorials...
I took the steps for that from her

the variables for longitude and latitude for current location are (longitude: currentlng, latitude: currentlat)

Image

that set hhhh
I hope you understand me

thanks
Asmaa,

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

display directions beftween two places

Please share (http://devcenter.appery.io/documentat...) your app with a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a and provide us with the following information:

1) App name
2) Test credentials if login functionality is implemented in your app
3) Detailed steps to reproduce the issue

Asmaa AlHammadi
Posts: 0
Joined: Tue May 12, 2015 12:56 pm

display directions beftween two places

I sent it
thankyou,

Return to “Issues”