Java Mapscript - querybyattribut SOLVED

Nicol Hermann mapserver at GEOWORLD.DE
Tue Apr 18 09:37:11 EDT 2006


Hi Umberto,

many thanks for your answer.

Am Dienstag, den 18.04.2006, 15:11 +0200 schrieb Umberto Nicoletti:
> Please add the list to cc (reply to all) so that everybody can benefit
> fro this ongoing discussion.

sorry. i forgot the list.
Find the answers to your questions between the lines.

> 
> That said I think you need to check some things (I haven't a recipe
> ready yet so we'll go by trial and error):
> 
> 1)that you environment is correctly setup with regard to
> internationalization (ie LANG and LC_* variables)

My environment variables are set to the following values:

nicol at emil:~$ echo $LANG
de_DE at euro

LC_* variables are not set.

nicol at emil:~$ set |grep LC_

> 
> 2) after that try to dump the content of the dbf file with dbfdump and
> see that content is correctly displayed (you might want to use xterm
> which does a better job that gnome-terminal for instance in displaying
> non-ascii characters)

the result of 'dbfdump' is correctly display. The german umlauts looks
fine.

nicol at emil:/tmp$ dbfdump subset.dbf
KREIS_KENN       KREIS_NAME
EW
07337            Südliche Weinstraße
109375
07339            Mainz-Bingen
194156

> 
> 3) open the Java source file with an editor like gedit (from GNOME)
> which will tell you the encoding of the java source and optionally
> recode it to the same encoding set by the LANG variable (use the
> recode command under linux).

My java source file is encoded with ISO-8859.

nicol at emil:~/workspace/msjava/msjava$ file queryByAttributMap.java
queryByAttributMap.java: ISO-8859 Java program text

I am not sure but i think this should match with the value of LANG
('de_DE at euro').

Anything else to check or to modify?
Nicol

> 
> Best regards,
> Umberto
> 
> 
> 
> On 4/18/06, Nicol Hermann <nicol at nicol.info> wrote:
> > Hi Umberto,
> >
> > as you suggested i compiled java mapscript with the option '-source
> > 1.4'.
> >
> > Therefor i modified the JAVAC Variable in the Makefile to 'JAVAC=javac
> > -source 1.4'.
> >
> > #
> > # Java Stuff
> > #
> > JAVADOC=javadoc
> > JAVAC=javac -source 1.4
> >
> > Attached you find the output of the compiling process [1].
> > Sadly this modification did not change the situation when i query for:
> >
> > layer.queryByAttributes(map,"KREIS_NAME", "/Südliche Weinstraße/",
> > mapscriptConstants.MS_MULTIPLE);
> >
> > in my test script.
> > Did i miss one step to fix this issue?
> >
> > Many thanks for your assistance
> > Nicol
> >
> >
> > [1]
> > nicol at emil:~/public_html/mapserver/sources/offical_releases/mapserver-4.8.1/mapscript/java$ make clean
> > rm -rf edu *.o *.c *.so *.java *.jar *.png
> > rm -rf examples/*.class
> > nicol at emil:~/public_html/mapserver/sources/offical_releases/mapserver-4.8.1/mapscript/java$ make interface
> > mkdir -p edu/umn/gis/mapscript
> > swig -java -package edu.umn.gis.mapscript -o
> > mapscript_wrap.c ../mapscript.i
> > mv *.java edu/umn/gis/mapscript/
> > nicol at emil:~/public_html/mapserver/sources/offical_releases/mapserver-4.8.1/mapscript/java$ make
> > gcc -fpic -c -g -O2 -fPIC -Wall  -DENABLE_STDERR_DEBUG
> > -DNEED_NONBLOCKING_STDERR -DIGNORE_MISSING_DATA -DHAVE_VSNPRINTF
> > -DNEED_STRLCAT  -DUSE_EPPL -DUSE_PROJ -DUSE_WMS_SVR -DUSE_WMS_LYR
> > -DUSE_WFS_SVR -DUSE_WFS_LYR -DUSE_MING_FLASH -DUSE_ORACLESPATIAL
> > -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT
> > -DGD_HAS_GDIMAGEGIFPTR -DGD_HAS_GETBITMAPFONTS  -DUSE_SDE -DUSE_OGR
> > -DUSE_GDAL -DUSE_POSTGIS    -I/usr/local/include  -I/usr/local/include
> > -I/usr/local/sdeexe83/include   -I/usr/local/include
> > -I/usr/local/pgsql_8/include
> > -I/home/oracle/product/10.1.0/client/rdbms/demo
> > -I/home/oracle/product/10.1.0/client/rdbms/public
> > -I/usr/local/j2sdk1.4.2_08/include
> > -I/usr/local/j2sdk1.4.2_08/include/linux -fno-strict-aliasing
> > mapscript_wrap.c
> > gcc -fpic -shared mapscript_wrap.o -o libmapscript.so  -L../.. -lmap
> > -lgd -L/usr/local/lib -lgd -ljpeg -lfreetype -lpng -lz    -ljpeg
> > -lfreetype -lpng -lz   -L/usr/local/lib -lproj -ljpeg
> > -L/usr/local/sdeexe83/lib -lsde83 -lpe83 -lsg83 -lpthread -ldl
> > -L/usr/local/lib -lgdal -lming -L/usr/local/pgsql_8/lib -lpq  -L/usr/lib
> > -lcurl -lidn -lssl -lcrypto -ldl -lssl -lcrypto -ldl -lz
> > -L/home/oracle/product/10.1.0/client/lib -lclntsh   -lm -lstdc++
> > javac -source 1.4 edu/umn/gis/mapscript/*.java
> > jar cf mapscript.jar edu
> >
> >
> > Am Freitag, den 14.04.2006, 15:23 +0200 schrieb Umberto Nicoletti:
> > > Olivier,
> > > I GOT IT!
> > >
> > > try to run the attached Java source. If you pass it two arguments the
> > > first being the path to the map file and the second the string to
> > > search for and you pass
> > > "Südliche Weinstraße" as the second it will work!
> > >
> > > So why does it fail when "Südliche Weinstraße" is inside the Java
> > > code? That is a problem that only happens when javac compiles the
> > > source: javac translates all characters to unicode and in doing that
> > > it gets the german characters wrong.
> > > To solve this give javac the following option: -source 1.4
> > >
> > > For more see this link:
> > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5046139
> > >
> > > On 4/13/06, Umberto Nicoletti <umberto.nicoletti at gmail.com> wrote:
> > > > This is probably not related only to java mapscript, so please read on.
> > > >
> > >
> > > So I was wrong...but I'll leave the proof to the reader ;-)
> > >
> > > Best regards,
> > > Umberto
> > >
> > > > On 3/30/06, Oliver Wesp <wesp at gdv.com> 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.
> > > > >
> > > >
> > > > Could someone of the other mapserver developers shed some light on this issue?
> > > >
> > > > I have a clue to give: php mapscript is using a different regex
> > > > library and this explains why the match does not happen for Java
> > > > mapscript, while it does happen in php mapscript. If I am right also
> > > > the mapserver cgi should be affected and possibly all other mapscript
> > > > too.
> > > >
> > > > It would be very interesting if someone could report on similar
> > > > experiences with the cgi-bin version of mapserver.
> > > >
> > > > Thanks,
> > > > Umberto
> > > >
> > > > > 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
> > > > > --
> > > > > Dipl.-Geogr. Oliver Wesp
> > > > > Gesellschaft fuer geografische Datenverarbeitung
> > > > > Binger Strasse 49-51
> > > > > D-55218 Ingelheim
> > > > > fon: +49 6132 714818
> > > > > fax: +49 6132 714828
> > > > > http: www.gdv.com
> > > > >
> > > >
> > >
> > >
> >
> >



More information about the mapserver-users mailing list