[OpenLayers-Users] How to add an overlay to the map,
but not select it by default
Adrian Popa
adrian_gh.popa at romtelecom.ro
Fri Jun 26 09:18:18 EDT 2009
Thanks for the tips,
I'm using mapserver because I managed to migrate my setup from an
existing mapserver installation (using a different frontend), and I
didn't have the time to dig into enabling (and troubleshooting WMS).
When the time comes, all Mapserver objects will become WMS.
I am already using the server side layer separation/generation trick to
include yahoo/google/openstreetmaps. This reduces page load time
significantly (because it doesn't have to load all the support js). My
question is: is this true also for overlay layers which are not enabled
- meaning would I get a moderate/significant boost in load time if I
don't add the overlays on page load, but on some user action?
Thanks,
Adrian
Alexandre Dube wrote:
> Hi,
>
> Some hints :
>
> - you should use OpenLayers.Layer.WMS instead of MapServer. I don't
> know the reason but some OL devs occasionally say this.
> - don't have too many OpenLayers.Layer objects in your map. It's
> slow. If you can, have many server-side layers single OL layers.
> Simply define them in the 'layers' param property, seperated by ',' if
> your OL layer is WMS or ' ' if MapServer :
> (WMS) layers:'mylayer1,mylayer2,mylayer3' or
> (MapServer) layers:'mylayer1 mylayer2 mylayer3'
>
> Just some hints,
>
> Regards,
>
> Alexandre
>
> Adrian Popa wrote:
>> Thanks! This is a cleaner way to do it :)
>>
>> Alexandre Dube wrote:
>>> Hi,
>>>
>>> Adrian Popa wrote:
>>>> Hello everyone,
>>>>
>>>> I'm trying to add several overlay layers (from mapserver) to an
>>>> openlayers map. Everything works as expected, but when the map
>>>> loads, all the overlay layers are selected. I would like to have
>>>> the ability (programmatically) to select which layers are selected
>>>> by default. Here's an example of how I enable an overlay layer:
>>>>
>>>> var rtc = new OpenLayers.Layer.MapServer("Test",
>>>> "http://terra/cgi-bin/mapserv", { map='/var/www/html/map/rtc.map',
>>>> transparent:true, format:'png',
>>>> map_imagetype: 'agg',layers: 'mylayer', maxExtent: new
>>>> OpenLayers.Bounds(20.26, 43.16, 29.70, 48.46), maxResolution:
>>>> 156543,units: 'm'},
>>>> { isBaseLayer:false, projection: sphericalMercator, singleTile:
>>>> 'true'});
>>>>
>>>>
>>>
>>> Add visibility:false to your options :
>>>
>>> { isBaseLayer:false, projection: sphericalMercator, singleTile:
>>> 'true', visibility:false}
>>>
>>>
>>>> map.addLayers([rtc]);
>>>>
>>>> I was unable to find a method in the documentation to allow me to
>>>> 'deselect' specific layers. If there is, I would appreciate a pointer.
>>>>
>>>> Thanks in advance,
>>>> Adrian
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at openlayers.org
>>>> http://openlayers.org/mailman/listinfo/users
>>>>
>>>
>>>
>>
>>
>
>
More information about the Users
mailing list