Page 2 of 4

Google maps wont center

Posted: Wed Apr 03, 2013 7:48 am
by michael kenny

did it, it works. Thats great.
thanks for the brilliant support.


Google maps wont center

Posted: Mon Jun 24, 2013 9:05 am
by ciccio

could you upload the new link please


Google maps wont center

Posted: Tue Jun 25, 2013 9:25 am
by Maryna Brodina

Google maps wont center

Posted: Tue Jul 15, 2014 4:03 pm
by Shawn

Hi

I'm facing a similar problem with the map not being centered and getting trimmed on the lower right and stumbled upon this solution ... so my question is I was using this code

map = Apperyio(gm).gmap;
if (!map) {
setDelay();
}

How do I change this to pass 'myOptions' as in the above example ?


Google maps wont center

Posted: Tue Jul 15, 2014 5:13 pm
by Kateryna Grynko

Hi Shawn,

What library version do you use? Could you please post a screenshot of the issue?
Are there any console errors?


Google maps wont center

Posted: Tue Jul 15, 2014 5:34 pm
by Shawn

Hi Katya

I'm using the latest libraries available on Appery :

Libraries : 2.0
JQuery 1.9.1
Jquery Mobile : 1.4.0
PhoneGap : 3.3.0

Not getting any Errors in the console.
I'm attaching the screen shot.

Here is my initialize(), mylocationmarker() called on Page Show
and setmarker() code called later reading markers from the DB

var directionsDisplay;
var map;
var markers = [];
var bounds = new google.maps.LatLngBounds();

function initialize(gm)
{
console.log('Initializing Map...');

Code: Select all

 map = Apperyio(gm).gmap; 
 if (!map) { 
     setDelay(); 
 }  

}

function setDelay() {
setTimeout(initialize, 50);
}

function mylocationmarker()
{
var iconBase = 'https://maps.google.com/mapfiles/kml/...';
var markerLatLng = new google.maps.LatLng(localStorage.getItem('markerLat'), localStorage.getItem('markerLng'));

var marker = new google.maps.Marker({
position: markerLatLng,
map: map,
title: 'My position',
animation: google.maps.Animation.DROP,
icon: iconBase + 'man_maps.png'
});

Code: Select all

 markers.push(marker); 
 bounds.extend(markerLatLng); 
 map.fitBounds(bounds);          

}

function setmarker(lat,lng,mtitle)
{
var markerLatLng = new google.maps.LatLng(lat,lng);

var marker = new google.maps.Marker({
position: markerLatLng,
map: map,
title: mtitle,
animation: google.maps.Animation.DROP
});

Code: Select all

 markers.push(marker); 
 bounds.extend(markerLatLng); 

map.fitBounds(bounds);
}

Image


Google maps wont center

Posted: Wed Jul 16, 2014 7:26 pm
by Kateryna Grynko

Hi Shawn,

Could you please post a public link to your app? How do you reproduce the issue?


Google maps wont center

Posted: Thu Jul 17, 2014 9:54 am
by Shawn

hi katya

you can login using

username : support
password : appery

and either click this url
http://airmeetings.herokuapp.com/MapR...

or from Home click 'meeting rooms' and then 'Map' button at the footer

rgds
shawn


Google maps wont center

Posted: Thu Jul 17, 2014 6:39 pm
by Kateryna Grynko

Hi Shawn,

Please try running the following code on Page Show event:preApperyio("google_map1").refresh();/pre


Google maps wont center

Posted: Thu Jul 17, 2014 8:23 pm
by Shawn

hi katya, that worked.. thanks!