Hello Pierre
I have put in the event listeners and overlays but found them slow
and sometimes the overlay would not go away. I tweaked it a bit and
got the overlays to load (or not load) properly but the performance
was still not good, I came up with another scheme that seems to work
more smoothly. I just added two lines to the function WMSGetTileUrl
(...) which check the map type and zoom level and then sets the
baseUrl and layer appropriately. So although there is slightly more
code used for each and every tile, this seems to have less impact than
adding or removing the overlay.
function WMSGetTileUrl(tile,zoom) {
if (this.name=='CanVec' && zoom<11) {var
baseUrl=C_NRCAN_RASTER.getTileLayers()[0].baseUrl; var
layer=C_NRCAN_RASTER.getTileLayers()[0].layer;}
else {var baseUrl = this.baseUrl; var layer = this.layer;}
...
return baseUrl+'&layers='+layer+'&bbox='+bbox+'&width='+this.tileSize
+'&height='+this.tileSize;
}
I'm not quite ready to put it on-line, so forgive me for not putting
up a link.
But in a nutshell, I do the following
1) check if this is the NRCan Vector map type and if the zoom is less
than 11
2) if so, change the baseURL and layer to point to the NRCan Raster
type.
I'm not sure doing this kind of stuff inside the GetTileUrl function
is allowed or recommended, but it definitely give better performance
for me.
Any comments?
On Sep 11, 5:30 pm, PierreB <[email protected]> wrote:
> One nice place near Marble Mountain is Mount Megantic. This mountain
> is surrounded by ridges that are so beautifull to cross during the
> winter with snowshoes.
>
> Concerning the possibility to use Raster Maps at lower zoom levels
> where Vector maps are not available, I found the following solution
> using GEvent.addListener and added instructions to the test
> filehttp://www.clubmontagnecanadien.qc.ca/sentier/toporama.htm.
>
> // raster map used for zoom levels 7 to 10
> var NRCAN_TOPO = WMSCreateMap('TopoCan Raster','<img alt="carte
> produite sur le site du cMc" src="../images/favicon.jpg" />
> © Natural Ressources Department of Canada','http://
> wms.cits.rncan.gc.ca/cgi-bin/cubeserv.cgi?exceptions=application/
> vnd.ogc.se_inimage&style=default','PUB_50K:CARTES_MATRICIELLES/
> RASTER_MAPS&transparent=true', 7, 18, 't' );
>
> raster = new GTileLayerOverlay( NRCAN_TOPO.getTileLayers()[0] );
> var raster_overlay=0;
>
> GEvent.addListener(carte, "zoomend", function()
> {
> if (carte.getCurrentMapType() == NRCAN_TOPORAMA_A)
> {
> zoom=carte.getZoom();
> if (zoom <=10) {carte.addOverlay(raster); raster_overlay=1;}
> else if (raster_overlay==1) {carte.removeOverlay(raster);
> raster_overlay=0;}
> }
> } );
> GEvent.addListener(carte, "maptypechanged", function()
> {
> if (carte.getCurrentMapType() != NRCAN_TOPORAMA_A)
> {
> if (raster_overlay==1)
> {carte.removeOverlay(raster); raster_overlay=0;}
> }
> else
> if (carte.getCurrentMapType() == NRCAN_TOPORAMA_A)
> {
> zoom=carte.getZoom();
> if (zoom <=10) {carte.addOverlay(raster); raster_overlay=1;}
> }
> } );
>
> Pierre
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en
-~----------~----~----~----~------~----~------~--~---