I just uploaded another sample map.  It has a few cosmetic changes,
but the main thing is the map type "CanVec" now switches to the old
raster tiles at zoom levels less than 11.

It would clearly be better to have the new data for all zoom levels,
but until the service improves, this at least allows you to move long
distances by dragging the map and then zooming in again.  Of course
since there are no place names on the old map tiles, you'll have to
know where you're going. <grin>

Link: http://tinyurl.com/nkv93y
Bring up the map and zoom out and you'll see the affect.

The script file is here (I greatly simplified a lot of the names in
the code)
http://members.bellatlantic.net/~vze2h6gy/papabear/scripts/CustomMapTypesAndControl
V2.js

On Sep 14, 4:18 pm, PierreB <[email protected]> wrote:
> Yes it is a simpler way to do it. As far as the function is well
> documented to indicate what is added.
>
> In the meantime I found that the WMS Toporama Service provides maps
> for all the zooms levels. The problem seems more one of Response-Time.
> I wrote to RNCAN to see if it comes from their server. I succeed to
> have map or some tiles at zoom levels 3 and 4. From 5 to 10, I rarely
> obtain tiles.
>
> PierreB
>
> On 14 sep, 11:05, Papa Bear <[email protected]> wrote:
>
> > 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" /> &nbsp;
> > > &nbsp; &copy; 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to