RE: [mapserver-users] Map background color using OL/WMS
Hi Paul, Maybe late to the show, but another strategy would be to explicitly state the bgcolor in the WMS request that OpenLayers composes like so: var wmsmap = new OpenLayers.Layer.WMS( Service name, url, { width: '600', height: '512', srs: 'EPSG:28992', layers: 'Dutch provinces', styles: '', format: 'image/png', bgcolor: '0x8FCAE7' }, { singleTile: true, ratio: 1, attribution: 'copy; 2009 Kadaster', visibility: true, isBaseLayer: true } ); Hope someone can benefit from this as well. Cheers, Edward ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Map background color using OL/WMS
Thanks for help... I changed the background in Openlayers CSS config: div.olMap { background-color: #e6fefe; } Paul On Tue, May 25, 2010 at 6:02 PM, Thomasch thomas...@gmx.de wrote: Am 25.05.2010 21:36, schrieb Paul james: Thanks Thomas... But how can I change the backround in Client Side? Just find the Id of your DIV containing yout map and change the backgound Color. Maybe there is in the Styles Secion someting like style #map { width: 800px; height: 500px; float: left; border: 1px solid #ccc; } [...] /style Just add background-color:#FF like style #map { width: 800px; height: 500px; float: left; border: 1px solid #ccc; background-color:#FF } [...] /style Thomasch ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Map background color using OL/WMS
Paul james wrote: Hello all... I have a Mapserver WMS application (using OL) ... How can I set the map background color? I tried to use : MAP IMAGECOLOR 230 254 254 ... Without success... Tried too : METADATA wms_bgcolor 0x8B No color change... To test your MapServer mapfile I recommend using the shp2img commandline utility (http://www.mapserver.org/utilities/shp2img.html). Once you have shp2img's resulting map image looking like you want, then you can test in your application. (this is how I would debug your problem, if I was hitting your issue) -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Map background color using OL/WMS
Thanks Jeff... But do you know how change map background ? Using Mapscript IMAGECOLOR works fine... With CGI/WMS/OL i cant get that to work... Paul On Tue, May 25, 2010 at 9:23 AM, Jeff McKenna jmcke...@gatewaygeomatics.com wrote: Paul james wrote: Hello all... I have a Mapserver WMS application (using OL) ... How can I set the map background color? I tried to use : MAP IMAGECOLOR 230 254 254 ... Without success... Tried too : METADATA wms_bgcolor 0x8B No color change... To test your MapServer mapfile I recommend using the shp2img commandline utility (http://www.mapserver.org/utilities/shp2img.html). Once you have shp2img's resulting map image looking like you want, then you can test in your application. (this is how I would debug your problem, if I was hitting your issue) -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Map background color using OL/WMS
Am 25.05.2010 20:21, schrieb Paul james: Thanks Jeff... But do you know how change map background ? Using Mapscript IMAGECOLOR works fine... With CGI/WMS/OL i cant get that to work... Paul Just a guess - I think you have to change the backround of your Map in the Client Side. If you don't have only one Layer, your wms Layers should be transparent. And as wms serves only Layers, there is no way to change the backgroundcolor on Server Side. But maybe I'm wrong Thomasch ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Map background color using OL/WMS
Thanks Thomas... But how can I change the backround in Client Side? Paul Just a guess - I think you have to change the backround of your Map in the Client Side. If you don't have only one Layer, your wms Layers should be transparent. And as wms serves only Layers, there is no way to change the backgroundcolor on Server Side. But maybe I'm wrong Thomasch ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
RE: [mapserver-users] Map background color using OL/WMS
If you really needed to set a background color, you could probably create an image of that color, georeference it to have an extent that matches your map extent and then set layer status to default for both of your layers. It still may be possible for someone to send a WMS to request only your data layer. Adding this raster layer will also incur some resources for processing. Whether it is significant or not, I don't know. To help you figure out the best solution, tell us what your use case is. It is likely that someone else has had a similar need. David. From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Paul james Sent: Tuesday, May 25, 2010 2:37 PM To: thomas...@gmx.de Cc: mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] Map background color using OL/WMS Thanks Thomas... But how can I change the backround in Client Side? Paul Just a guess - I think you have to change the backround of your Map in the Client Side. If you don't have only one Layer, your wms Layers should be transparent. And as wms serves only Layers, there is no way to change the backgroundcolor on Server Side. But maybe I'm wrong Thomasch ___ mapserver-users mailing list mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Map background color using OL/WMS
Am 25.05.2010 21:36, schrieb Paul james: Thanks Thomas... But how can I change the backround in Client Side? Just find the Id of your DIV containing yout map and change the backgound Color. Maybe there is in the Styles Secion someting like style #map { width: 800px; height: 500px; float: left; border: 1px solid #ccc; } [...] /style Just add background-color:#FF like style #map { width: 800px; height: 500px; float: left; border: 1px solid #ccc; background-color:#FF } [...] /style Thomasch ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users