[OpenLayers-Users] Zooming with multiple kamap layers

Mike Leahy mgleahy at alumni.uwaterloo.ca
Sat Jul 26 02:10:18 EDT 2008


Hello list,

I've been working on an application that uses Ka-Map, but I think I 
might consider adopting OpenLayers for the client-side part.  I have 
been able to setup a map that loads two layers (see sample HTML below). 
   When the map initially starts, I call roads.setVisibility(true);, and 
I see the roads layer overlaid on top of the aerial photography layer. 
It looks fine at that point...panning works fine.  Once I zoom in or 
out, however, the base layer (the photography) does what is expected, 
but the roads layer just defaults to its original extent, and remains at 
the initial zoom level.  Is there something I need to do to tie the 
roads layer to the zoom event?

If this is a known issue, or if I'm just missing something, maybe 
someone can point me in the right direction.  I'm using OpenLayers 2.6 
(should I try SVN?).  The tile.php script is something that I have 
integrated into my application on the server - it's generally based on 
the one from kamap (checked out of svn about a month ago), but I don't 
think it's the source of this issue (i.e., if I make the roads layer the 
base layer on its own, it works fine).

Thanks in advance for any help,
Mike

======================================================================

<html>
<head>
   <title>OpenLayers  Example</title>
     <script
     src="https://localhost/application/js/lib/OpenLayers.js"></script>
     </head>
     <body>
       <div  style="width:100%;  height:100%"  id="map"></div>
       <script  defer="defer"  type="text/javascript">
         var  options  =  {
           maxExtent:  new 
OpenLayers.Bounds(1327479,4883397,1415461,5034462),
           scales:  [200000,150000,100000,75000,50000,25000,10000,5000],
           numZoomLevels:  8,
           tileSize:  new  OpenLayers.Size(400,300),
           projection:  "EPSG:4326",
           units:  "m"
         };
         var  map  =  new  OpenLayers.Map('map',options);
         var  aerials  =  new  OpenLayers.Layer.KaMap("mymap",
           "https://localhost/application/tile.php",
           {layers:"0",i:"AGG_JPEG",map:"mymap",g:"Aerial 
Photography",sid:"somesessionid"}
         );
         var  roads  =  new  OpenLayers.Layer.KaMap("mymap",
           "https://localhost/application/tile.php",
 
{layers:"160",i:"alpha",map:"mymap",g:"Roads",sid:"somesessionid"},
           {numZoomLevels:8,scales: 
[200000,150000,100000,75000,50000,25000,10000,5000]}
         );
         map.addLayers([aerials,roads]);
         map.zoomToExtent(new 
OpenLayers.Bounds(1373558,4988812,1404038,5011460));
         roads.setVisibility(true);
       </script>
</body>
</html>



More information about the Users mailing list