[Gvsig_english] WMS layer's STYLE properties in requests

fla83tn at libero.it fla83tn at libero.it
Thu Nov 26 12:54:35 CET 2009


Hi to all,
I'm using v1.9 build 1253 of gvSIG and I've experienced some 
annoying problem when trying to import a Digital Elevation Model layer exposed 
by 
UMN Mapserver via WMS as a raster.

The problem is that gvSIG tries to 
download WMS layers appending to the request a STYLE=null parameter, which is 
not supported by UMN Mapserver.
Just try, for example, to import the WMS 
service 

       http://wms.pcn.minambiente.it/cgi-bin/mapserv.exe?
map=/ms_ogc/service/dtm_20m.map

You'll se that the layer will not load. The 
error is caused in WMSProtocolHandler of libRemoteService that check the length 
of the styles vector:

if (v != null && v.size() > 0) {...}

Indeed, the vector 
is not null and has length=1, but all of its elements are null....and this is 
cause of the method Vector2CS of class Utilities.

My suggestion is to cahnge 
the following method in Utilities.java (libRemoteService project):

public 
static String Vector2CS(Vector v)	{
		String str = new String();
		if (v != 
null)
		{
			int i;
			for (i=0; i<v.size() ;i++)
			{
				str = str + v.
elementAt(i);
				if (i<v.size()-1)
					str = str + ",";
			}
		}
		return 
str;
	}

with:
public static String Vector2CS(Vector v) {
		String str = new 
String();
		if (v != null) {
			int i;
			for (i = 0; i < v.size(); i++) {
				
Object currentElement = v.elementAt(i);
				if (currentElement != null) {
					
str = str + currentElement;
					if (i < v.size() - 1) {
						str = str + ",";

					}
				}
			}
		}
		return str;
	}

Another problem is to fix the problem 
at an upper level, that is, find WHY the styles vector has length=1 but all of 
its elements are null...

Best regards,
Flavio


More information about the Gvsig_internacional mailing list