Java Mapscript - querybyattribut
listuser HH
listuser at HERZSYS.DE
Fri Mar 31 00:35:54 PST 2006
Oliver Wesp wrote:
> Dear List,
>
> I' struggling with queryByAttributes on an attribute field with german
> umlauts using java mapscript.
> The odd thing is that the same thing works fine with php mapscript and
> when I use expressions in my mapfile. I'm using a shapefile as
> datasource.
>
> Here is what I do:
>
> layer.queryByAttributes(map,"KREIS_NAME", "/Südliche Weinstraße/",
> mapscriptConstants.MS_MULTIPLE);
> layer.open();
> System.out.println( "Result Count: " +layer.getNumResults() );
> layer.close();
>
> The result is always null while replacing the qstring with something
> that doesn't contain special characters (e.g.
> 'Mainz-Bingen') works fine.
>
> As noted above the following layer definition in a mapfile works fine
>
> LAYER
> NAME kreis
> STATUS DEFAULT
> TYPE polygon
> DATA "/tmp/subset"
> TEMPLATE "kreis.html"
> CLASSITEM KREIS_NAME
> CLASS
> NAME Boundary
> COLOR 128 128 0
> OUTLINECOLOR 0 0 0
> EXPRESSION /Südliche Weinstraße/
> END
> END
>
>
> but this does not:
>
> layer.setClassitem("KREIS_NAME");
> classObj cl = new classObj(layer);
> cl.setName("Classname");
> cl.setExpression("/Südliche Weinstraße/");
>
> I use Mapserver 4.8.1 on W2k, Tomcat 5.0.28.
>
> I can provide some sample data, just in case someone likes to reproduce.
>
> Any help is appreciated.
>
> best regards
> Oliver
Hi Oliver,
only a guess but there seems to a difference in the string encoding
between the mapserver lib in the system and java. Try to convert the
String before you set the expression in your code. (-> String( byte
bytes[], String ) throws UnsupportedEncodingException)
Please let me if this helps or how you solved it.
Regards,
Norbert
More information about the MapServer-users
mailing list