Page 1 of 1

Is it possible to use two maps in one app, on different pages?

Posted: Fri Jun 12, 2015 6:06 pm
by umama fakher

I want to display two maps on different pages of my application.

First Map is displaying locations from db.
Second Map showing Current location.

Problem is that when I am initializing my both map using following javascript:
code
var map;
var directionsDisplay;

var bounds = new google.maps.LatLngBounds();

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

Code: Select all

 map = Appery("map1").gmap; 
 if (!map) 
 { 
     setDelay(); 
 } 
 else 
 { 
    directionsDisplay = new google.maps.DirectionsRenderer(); 
 } 

}

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

Code: Select all

 map = Appery("map2").gmap; 
 if (!map) 
 { 
     setDelay(); 
 } 
 else 
 { 
    directionsDisplay = new google.maps.DirectionsRenderer(); 
 } 

}

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

code

so only one map works perfectly other is not working i.e not displaying locations from my database. Note: The map which is not showing database location was showing locations before adding second map(For current Location).

Also the maps take so much time in loading. I want it to load as soon as it appears.

Please Help !!/code/code