On Nov 29, 1:47 am, alasarr <albertoasu...@gmail.com> wrote: > Hello, > > In my app I've several kml layers and I'd like to set a priority > between thems. I've a kmz service an a advanced javascript control > layer. You can't check it onhttp://golfvision.nearsur.es/mapa/ > > Layer A: background layer with a big polygon. > Layer B: markers to draw over layer A. > > I need to force layer B will be always drawn after layer A, because if > layer A is drawn after layer B it's not possible to click over the > markers. > > I've found anything on api doc about how several kmls are drawn. I > think (according to I've could find out) google maps draws kmls > asynchronously. Is that correct? Could anyone confirm that?
You might try "starring" this issue: http://code.google.com/p/gmaps-api-issues/issues/detail?id=2804 -- Larry > > My first approach was call to layer setMap in a correct order. > > // order layers by priority. The Bubble Sort method. > var i,j; > for(i = 0; i < this.layers.length; i++) > { > for(j = 0; j < (this.layers.length-1); j++) > { > if(this.layers[j].priority > this.layers[j+1].priority) > { > var holder = this.layers[j+1]; > this.layers[j+1] = this.layers[j]; > this.layers[j] = holder; > } > } > > } > > for(i=0; i<this.layers.length; i++) > { > if ( this.layers[i].isVisible(this.mashup.map) ) > { > this.layers[i].layerObj.setMap(this.mashup.map); > } > else > { > this.layers[i].layerObj.setMap(null); > } > > } > > This works fine if the time of drawn of each kml is very very simiiar. > This time of draw is defined by the time of google to download the > source kmz file and the time of draw it. I think this happens because > of google maps draws kmls asynchronously > > Now I'm doing lots of workaround to fix this but these ones are not > good on performance. E.g: activate/desactivate layers after > metada_changed event. > > this.layerObj = new google.maps.KmlLayer(url,gkmlOpts); > > google.maps.event.addListener(this.layerObj, "metadata_changed", > function(){ > ... > > > > > > > > }); -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to google-maps-js-api-v3@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.