Hi Dushan,
This looks like a OpenLayers thing; you might want to try mailing it to
their mailing list as they're more likely to be able to help you.

Jonathan



On 9 July 2013 06:08, Dushan Niwantha <[email protected]> wrote:

> Hi,
> I'm using 5 layers and passing random values to VIEWPARAMS to select the
> wanted area. I added a layer switcher(mentioned in red at the bottom of the
> script) to show/hide layers. but switch layer component doesn't appear on
> openlayers map viewer. Please be kind to respond. need help.
>
> Regards.
>
> <script src="wms_files/OpenLayers.js" type="text/javascript"></script>
> <script defer="defer" type="text/javascript">
> var legs = "<%= geoParam %>";
> var layer_one_legs = "<%= geoParamLayerOne %>";
> var layer_two_legs = "<%= geoParamLayerTwo %>";
> var layer_three_legs = "<%= geoParamLayerThree %>";
> var layer_four_legs = "<%= geoParamLayerFour %>";
> var layer_four_five = "<%= geoParamLayerFive %>";
>
> var map;
> var base;
>
> var layer_one;
> var layer_two;
> var layer_three;
> var layer_four;
> var layer_five;
>
> /* pink tile avoidance */
> OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
> /* make OL compute scale according to WMS spec */
> OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;
>
> function init() {
>
> format = 'image/png';
>  var bounds = new OpenLayers.Bounds(
>                     97057.023,
>                     174768.406,
>                     118472.391,
>                     192859.141);
> var options = {
>                     controls : [],
>                     maxExtent : bounds,
>                     maxResolution : 83.65378125000001,
>                     projection : "EPSG:2020",
>                     units : 'm'
> };
> map = new OpenLayers.Map('map', options);
>
> /* setup base layer */
> base = new OpenLayers.Layer.WMS(
> "Base",
> "http://localhost:8080/geoserver/wms";,
> {
> LAYERS : 'rda2',
> transparent: "true",
> singleTile: true,
> format : format
> },
> {
> buffer : 0,
> isBaseLayer : true,
> displayInLayerSwitcher:false
> });
>
>  /* setup layer_one */
> layer_one = new OpenLayers.Layer.WMS(
> "Layer 01",
> "http://localhost:8080/geoserver/wms";,
> {
> VIEWPARAMS: layer_one_legs,
> LAYERS : 'RDA2_VIEW_LAYER_ONE',
> transparent: "true",
> singleTile: true,
> format : format
> },
> {
> buffer : 0,
> isBaseLayer : false,
> displayInLayerSwitcher:true
> });
>
>  /* setup layer_two */
> layer_two = new OpenLayers.Layer.WMS(
> "Layer 02",
> "http://localhost:8080/geoserver/wms";,
> {
> VIEWPARAMS: layer_two_legs,
> LAYERS : 'RDA2_VIEW_LAYER_TWO',
> transparent: "true",
> singleTile: true,
> format : format
> },
> {
> buffer : 0,
> isBaseLayer : false,
> displayInLayerSwitcher:true
> });
>
>  /* setup layer_three */
> layer_three = new OpenLayers.Layer.WMS(
> "Layer 03",
> "http://localhost:8080/geoserver/wms";,
> {
> VIEWPARAMS: layer_three_legs,
> LAYERS : 'RDA2_VIEW_LAYER_THREE',
> transparent: "true",
> singleTile: true,
> format : format
> },
> {
> buffer : 0,
> isBaseLayer : false,
> displayInLayerSwitcher:true
> });
>
>  /* setup layer_four */
> layer_four = new OpenLayers.Layer.WMS(
> "Layer 04",
> "http://localhost:8080/geoserver/wms";,
> {
> VIEWPARAMS: layer_four_legs,
> LAYERS : 'RDA2_VIEW_LAYER_FOUR',
> transparent: "true",
> singleTile: true,
> format : format
> },
> {
> buffer : 0,
> isBaseLayer : false,
> displayInLayerSwitcher:true
> });
>
>  /* setup layer_five */
> layer_five = new OpenLayers.Layer.WMS(
> "Layer 05",
> "http://localhost:8080/geoserver/wms";,
> {
> VIEWPARAMS: layer_four_five,
> LAYERS : 'RDA2_VIEW_LAYER_FIVE',
> transparent: "true",
> singleTile: true,
> format : format
> },
> {
> buffer : 0,
> isBaseLayer : false,
> displayInLayerSwitcher:true
> });
>
> /* map.addLayers([untiled, tiled ]); */
> map.addLayers([base, layer_five, layer_four, layer_three, layer_two,
> layer_one]);
>
> /* build up all controls */
> map.addControl(new OpenLayers.Control.PanZoomBar(
> {
> position : new OpenLayers.Pixel(2,15)
> }));
> map.addControl(new OpenLayers.Control.Navigation());
> map.addControl(new OpenLayers.Control.LayerSwitcher());
> map.zoomToExtent(bounds);
> }
>
> </script>
>
> --
> Me on Web
> http://dushan888.wordpress.com
> http://www.linkedin.com/pub/dushan-basnayake/18/9a7/8b9
> http://www.twitter.com/Dushi
>
>
>
> ------------------------------------------------------------------------------
> See everything from the browser to the database with AppDynamics
> Get end-to-end visibility with application monitoring from AppDynamics
> Isolate bottlenecks and diagnose root cause in seconds.
> Start your free trial of AppDynamics Pro today!
> http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>

-- 
This transmission is intended for the named addressee(s) only and may 
contain sensitive or protectively marked material up to RESTRICTED and 
should be handled accordingly. Unless you are the named addressee (or 
authorised to receive it for the addressee) you may not copy or use it, or 
disclose it to anyone else. If you have received this transmission in error 
please notify the sender immediately. All email traffic sent to or from us, 
including without limitation all GCSX traffic, may be subject to recording 
and/or monitoring in accordance with relevant legislation.
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to