michael kenny
Posts: 0
Joined: Tue Apr 02, 2013 2:47 pm

Google maps wont center

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

ciccio
Posts: 0
Joined: Fri Jun 14, 2013 10:40 am

Google maps wont center

could you upload the new link please

Shawn
Posts: 0
Joined: Sat Jun 21, 2014 11:13 pm

Google maps wont center

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 ?

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

Google maps wont center

Hi Shawn,

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

Shawn
Posts: 0
Joined: Sat Jun 21, 2014 11:13 pm

Google maps wont center

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

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

Google maps wont center

Hi Shawn,

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

Shawn
Posts: 0
Joined: Sat Jun 21, 2014 11:13 pm

Google maps wont center

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

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

Google maps wont center

Hi Shawn,

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

Shawn
Posts: 0
Joined: Sat Jun 21, 2014 11:13 pm

Google maps wont center

hi katya, that worked.. thanks!

Return to “Issues”