2 kml layers order issues with different browsers.

34 views
Skip to first unread message

az az

unread,
Nov 3, 2011, 10:30:53 AM11/3/11
to google-map...@googlegroups.com
Hi all,

I have 2 kmls and I'd like to have ctalayer2 to be on top of ctalayer. I have 

var ctaLayer = new google.maps.KmlLayer('http://www.bgstreet.co.uk/bgstr/people23.kmz', {preserveViewport: true,suppressInfoWindows: true});
var ctaLayer2 = new google.maps.KmlLayer('http://www.bgstreet.co.uk/bgstr/buss.kml', {preserveViewport: true,suppressInfoWindows: true});

ctaLayer.setMap(map);
ctaLayer2.setMap(map);

Which works fine in opera browser, always. In other browsers (i.e. chrome, IE8, FF) it shows ctalayer on top of ctalayer2. Always. It seems is is not random how that layers are stacked. 
Moreover:

ctaLayer2.setMap(map);
ctaLayer.setMap(map);
 

will result that in all browser (incl. opera)   ctalayer is on top of ctalayer2.

How can I have  ctalayer2 to be on top of ctalayer  always and in all browsers?

geoco...@gmail.com

unread,
Nov 3, 2011, 10:48:29 AM11/3/11
to Google Maps JavaScript API v3
On Nov 3, 7:30 am, az az <lefte...@bgnet.bg> wrote:
> Hi all,
>
> I have 2 kmls and I'd like to have ctalayer2 to be on top of ctalayer. I
> have
>
> *var ctaLayer = new
> google.maps.KmlLayer('http://www.bgstreet.co.uk/bgstr/people23.kmz',
> {preserveViewport: true,suppressInfoWindows: true});
> var ctaLayer2 = new
> google.maps.KmlLayer('http://www.bgstreet.co.uk/bgstr/buss.kml',
> {preserveViewport: true,suppressInfoWindows: true});
>
> ctaLayer.setMap(map);
> ctaLayer2.setMap(map);*
> *
> *
> Which works fine in opera browser, always. In other browsers (i.e. chrome,
> IE8, FF) it shows ctalayer on top of ctalayer2. Always. It seems is is not
> random how that layers are stacked.
> Moreover:
>
> *ctaLayer2.setMap(map);
> ctaLayer.setMap(map);*
>
> will result that in all browser (incl. opera)   ctalayer is on top of
> ctalayer2.
>
> How can I have  ctalayer2 to be on top of ctalayer always and in all
> browsers?

You seem to have the answer in your email. There is an enhancement
request for control over the order of the layers:
http://code.google.com/p/gmaps-api-issues/issues/detail?id=2804

Until then, it seems they always are layered in the order they are
added. So this:
ctaLayer2.setMap(map);
ctaLayer.setMap(map);

Should put ctaLayer on top of ctaLayer2 (with the possible exception
of the first time when rendering time might make a difference).

-- Larry

az az

unread,
Nov 3, 2011, 11:11:58 AM11/3/11
to google-map...@googlegroups.com
whatever I do ctalayer2 is always beneath ctalayer.

only opera honors the order as imposed by  

ctaLayer2.setMap(map);
ctaLayer.setMap(map); 

OR

ctaLayer.setMap(map); 
ctaLayer2.setMap(map);

geoco...@gmail.com

unread,
Nov 3, 2011, 11:15:00 AM11/3/11
to Google Maps JavaScript API v3
On Nov 3, 8:11 am, az az <lefte...@bgnet.bg> wrote:
Where is the map that exhibits this behavior?

-- Larry

az az

unread,
Nov 3, 2011, 11:16:51 AM11/3/11
to google-map...@googlegroups.com

ctalayer2 is a blue truck icon
Reply all
Reply to author
Forward
0 new messages