Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

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

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();

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

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

Did you test that these statements:

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

return the correct data?

Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

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

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

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

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

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

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

Andy Parker
Posts: 0
Joined: Wed Mar 27, 2013 10:21 am

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

that did it!

You sir, are a legend, many thanks.

Carlos Pinto
Posts: 0
Joined: Mon Oct 14, 2013 11:09 am

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

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!

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

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.

Return to “Issues”