[OpenLayers-Users] Opacity Kills Map

Pierre GIRAUD bluecarto at gmail.com
Fri Jan 18 03:31:06 EST 2008


There are syntax errors in your code. (');' -> ',')
Here is the code for the layers precip and nexrad that worked for me :

var precip = new OpenLayers.Layer.WMS( "Total Storm Precip",
    "http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/ntp.cgi?",
    {layers: "nexrad_stormtotal_precip", transparent: "true", format:
"image/png" },
    {isBaseLayer: false, opacity: 0.5});

 var nexrad = new OpenLayers.Layer.WMS( "Nexrad Radar 5min",
    "http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?",
    {layers: "nexrad_base_reflect", transparent: "true", format:"image/png" },
    {isBaseLayer: false, opacity: 0.5});

Pierre

On Jan 18, 2008 8:01 AM, chris1211 <chris at powerhousetechgrp.com> wrote:
>
> When i add the opacity to my map it kills it can some one help i dont really
> understand the format or what im doing wrong thanks.... chris
>
> <html xmlns="http://www.w3.org/1999/xhtml">
>   <head>
>     <style type="text/css">
>         #map {
>             width: 70%;
>             height: 500px;
>             border: 1px solid black;
>         }
>     </style>
>     <script src="../lib/OpenLayers.js"></script>
>     <script type="text/javascript">
>         var map;
>         function init(){
>  var bounds = new
> OpenLayers.Bounds(-88.55546395,36.1137137,-87.98201304999999,36.5199723);
>  map = new OpenLayers.Map('map', { controls: [] });
>                 map.addControl(new OpenLayers.Control.PanZoomBar());
>                 map.addControl(new OpenLayers.Control.MouseToolbar());
>
>             map.addControl(new
> OpenLayers.Control.LayerSwitcher({'div':OpenLayers.Util.getElement('layerswitcher')}));
>
>             var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
>                 "http://13.0.0.150:8080/geoserver/wms",
>                 {layers: 'topp:henry'}, {'displayInLayerSwitcher':false} );
>
>             var zone_wms = new OpenLayers.Layer.WMS( "FEMA Flood Zones",
>
> "http://hazards.fema.gov/wmsconnector/wmsconnector/Servlet/flood",
>                 {layers: "Flood_Hazard_Zones", transparent: "true", format:
> "image/png" });
>      map.addLayer(zone_wms);
>
>             var dm_wms = new OpenLayers.Layer.WMS( "FEMA DFIRM PANELS",
>
> "http://hazards.fema.gov/wmsconnector/wmsconnector/Servlet/flood",
>                 {layers: "Panels", transparent: "true", format: "image/png"
> });
>
>
>  var precip = new OpenLayers.Layer.WMS( "Total Storm Precip",
>
> "http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/ntp.cgi?",
>                 {layers: "nexrad_stormtotal_precip", transparent: "true",
> format: "image/png" });
> {isBaseLayer: false, opacity: 0.5});
> map.addLayer(precip);
>
>
>  var nexrad = new OpenLayers.Layer.WMS( "Nexrad Radar 5min",
>
> "http://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?",
>                 {layers: "nexrad_base_reflect", transparent: "true", format:
> "image/png" });
>                 {isBaseLayer: false, opacity: 0.5});
> map.addLayer(nexrad);
>
>    zone_wms.setVisibility(true);
>             dm_wms.setVisibility(true);
>
> map.addLayers([ol_wms, zone_wms, dm_wms,precip]);
> map.setCenter(new OpenLayers.LonLat(-88.328666,36.301788), 11);
>
>         }
>     </script>
>   </head>
>   <body onload="init()">
>     <h1>FEMA Flood Map's and Panel Numbers</h1>
>
>     <div id="layerswitcher" style="float:top; width: 20em;"></div>
>     <div id="map"></div>
>     <div id="docs">
>       <p>Info and Desc.</p>
>    </div>
>   </body>
> </html>
>
> --
> View this message in context: http://www.nabble.com/Opacity-Kills-Map-tp14947394p14947394.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list