Opened 17 years ago

Closed 17 years ago

#2349 closed defect (fixed)

transparent and bgcolor should be supported in mapfile metadata

Reported by: tomkralidis Owned by: tomkralidis
Priority: normal Milestone: 5.2 release
Component: WMS Client Version: 5.0
Severity: normal Keywords:
Cc: frodewj@…, mapserverbugs

Description

Mapserver uses the METADATA element in the mapfile to spesify the different WMS parameters, such as SRS, NAME and so on...

E.g:

	 METADATA
	  "wms_server_version"   "1.1.1"
	  "wms_srs"              "EPSG:32633"
	  "wms_name"             "Samkopi" 
	  "wms_format"           "image/png"
	  "wms_style"      "default"
	  "wms_bgcolor"     "0xFFFFFF"
	 END

Is there any way to add the WMS TRANSPARENT parameter in the same way?

We have noticed that Mapserver automatically adds TRANSPARENT=TRUE when fetching WMS data (GetMap). It seems that this behaviour also conserns the WMS BGCOLOR element, that is...we are not able to send TRANSPARENT=FALSE...

Change History (5)

comment:1 by dmorissette, 17 years ago

So what you propose is to add a "wms_transparent" metadata with possible values being "TRUE" or "FALSE" and the default (if not specified) being "TRUE"? That works for me.

I don't think we currently support wms_bgcolor so we should probably add that as well.

comment:2 by tomkralidis, 17 years ago

In http://portal.opengeospatial.org/files/?artifact_id=1081&version=1&format=pdf, TRANSPARENT and BGCOLOR are discussed in section 7.2.3.9/7.2.3.10.

In reading this, I suggest:

- if MAP/LAYER/METADATA/wms_bgcolor
 - set BGCOLOR
- if MAP/LAYER/METADATA/wms_transparent
 - set TRANSPARENT
- else
 - set TRANSPARENT=TRUE

Make sense?

comment:3 by tomkralidis, 17 years ago

Actually, in testing this logic, if BGCOLOR is set, and TRANSPARENT is set to TRUE, the WMS server (MapServer in this case) returns a transparent image.

So the above logic should be changed to:

- if MAP/LAYER/METADATA/wms_bgcolor
 - set BGCOLOR
 - set TRANSPARENT=FALSE
- else
 - if MAP/LAYER/METADATA/wms_transparent
  - set TRANSPARENT
 - else
  - set TRANSPARENT=TRUE

...which basically means: always request a non-transparent image when passing BGCOLOR.

FYI this change will not affect existing configurations.

I have this working locally. Daniel: let me know if this makes sense before I commit.

comment:4 by dmorissette, 17 years ago

I think your first proposal in comment:2 was better. I don't think BGCOLOR and TRANSPARENT are mutually exclusive or need to be, or anyway the WMS spec doesn't state that requirement. I'd leave it possible for the user to decide if they want to set both or not.

comment:5 by tomkralidis, 17 years ago

Resolution: fixed
Status: newclosed

OK. I just hope we don't run into cases where a user sets wms_bgcolor and wms_transparent to TRUE (then again, why would they), or forgets to set wms_transparent to FALSE, which would render wms_bgcolor useless.

Changes (based on comment:2):

Note: See TracTickets for help on using tickets.