Page 1 of 1

Google Maps - making the map display at the requested longitude and latitude

Posted: Fri Jun 07, 2013 2:44 pm
by Andy Parker

Hi,
I've been trying to get my Geolocation app working for some time now, trying all of the different approaches to get the map to show the longitude and latitude position I give it, but it just does not move.

My code is simple, I have the Geoservice being called every 5 seconds, this service updates 2 labels on the display, "mylatitude" and "mylongitude".

the code below is supposed to run when I click a button, it does run (as I have an alert to pop up) but the map does not change to show my location, can someone help me please?

var map = Appery('map');
map.options['latitude'] = Appery('mylatitude').text();
map.options['longitude'] = Appery('mylongitude').text();
map.refresh();


Google Maps - making the map display at the requested longitude and latitude

Posted: Fri Jun 07, 2013 4:55 pm
by maxkatz

Did you test that these statements:

code
Appery('mylatitude').text();
Appery('mylongitude').text();
/code

return the correct data?


Google Maps - making the map display at the requested longitude and latitude

Posted: Fri Jun 07, 2013 5:53 pm
by Andy Parker

yes, I used the alert function to display them, and received the expected results.

alert(Appery('mylatitude').text());
alert(Appery('mylongitude').text());


Google Maps - making the map display at the requested longitude and latitude

Posted: Fri Jun 07, 2013 6:15 pm
by maxkatz

also add this:
code
map.options['address'] = "&quot
/code


Google Maps - making the map display at the requested longitude and latitude

Posted: Fri Jun 07, 2013 6:18 pm
by Andy Parker

that did it!

You sir, are a legend, many thanks.


Google Maps - making the map display at the requested longitude and latitude

Posted: Mon Oct 14, 2013 11:09 am
by Carlos Pinto

Hi, i am absolutely new to appery and now i found this thread what seems to in theory help me a bit about what i want to archive.

my question: where do i add this code?
do i put it directly inside my html at the "web_resources/files/test.html" ?

thanks in advance for your time and support!


Google Maps - making the map display at the requested longitude and latitude

Posted: Mon Oct 14, 2013 11:41 am
by Kateryna Grynko

Hi Carlos,

For HTML code you can you Panel component with type=html.
JavaScript code can be added in 'Run JavaScript' actions (see Events panel).
You can also add CSS and JavaScript code in assets (see Create new menu).

The code discussed here fires on button click event.