Page 3 of 4

Google maps wont center

Posted: Tue Jul 22, 2014 5:41 pm
by Shawn

Hi Katya

Now this is very strange! it worked 5 days ago and now the problem seems to have reappeared. I still have Apperyio("google_map1").refresh(); on page show which is triggered after the marker points are plotted on the map.

I've plotted just one point in barcelona to show as an example and provided a screen shot

Image


Google maps wont center

Posted: Thu Jul 24, 2014 7:03 am
by Kateryna Grynko

Hi Shawn,

Please try these solutions:
http://stackoverflow.com/questions/10...


Google maps wont center

Posted: Sun Aug 03, 2014 4:36 pm
by Shawn

Hi

I seem to have solved the google map cropping problem but am now facing a slightly different challenge.

I'm calling the initialize() function on page load with a timeout of 50 but it seems to be taking quite some time to finish is there any way to wait till completion ?
Because subsequent marker calls like map.fitBounds(bounds) is failing as map' isn't getting initialized . Please note : For me 'Render all pages in one HTML file' is ON

Here is the code again

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

Code: Select all

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

}

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'
});

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


Google maps wont center

Posted: Sun Aug 03, 2014 4:44 pm
by Shawn

Also tried calling initiatlize() on Page Show


Google maps wont center

Posted: Sun Aug 03, 2014 11:31 pm
by Yurii Orishchuk

Hi Shawn,

Please replace your code:

pre

map = Apperyio("google_map").gmap;

/pre

with following one:

pre

var map = Appery("google_map").options.mapElement.gmap('get', 'map');

/pre

Regards.


Google maps wont center

Posted: Mon Aug 04, 2014 8:49 am
by Shawn

Gives an Error 'Uncaught TypeError: Cannot read property 'options' of undefined'
and hangs the system. Here is the code ...

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

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

Code: Select all

 map = Appery("google_map").gmap.options.mapElement.gmap('get','map'); 
 if (!map) { 
     setDelay(); 
 }  

}

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


Google maps wont center

Posted: Mon Aug 04, 2014 10:34 pm
by Yurii Orishchuk

Hi Shawn,

You currently use code:

pre

map = Appery("google_map").gmap.options.mapElement.gmap('get','map');

/pre

But i've provide you with following one:

pre

var map = Appery("google_map").options.mapElement.gmap('get', 'map');

/pre

Please use given code, don't try to change it.

Regards.


Google maps wont center

Posted: Mon Aug 04, 2014 10:49 pm
by Shawn

Oops that was an early morning fix without any coffee :)
Your code has worked, Thanks Yurii


Google maps wont center

Posted: Fri Dec 05, 2014 8:44 am
by Cristian Hidalgo

Page not found :(


Google maps wont center

Posted: Fri Dec 05, 2014 8:56 am
by Illya Stepanov

Hi Cristian,

What exactly page is not found?