Java Mapscript - querybyattribut
Benedikt Rothe
umn-ms at HYDROTEC.DE
Thu Apr 13 00:38:35 PDT 2006
Hi
The C-Wrapper "mapscript_wrap.c" converts Java-Strings to
"char*" with the JNI-Function "GetStringUTFChars".
This UTF-8-byte-sequence is passed to the mapserver-kernel.
But mapserver-kernel expects an one-byte-encoding. (ISO-8859-1 or CP437
(!?))
I wrote a JNI-sample-program to illustrate.
The sample-program converts to UTF-8, ISO-8859-1 and CP437.
On my Windows-Command-Prompt the CP437-result was correct.
I think mapscript_wrap.c has to do more than UTF-8-Conversion.
Benedikt
UMN MapServer Users List <MAPSERVER-USERS at LISTS.UMN.EDU> schrieb am
12.04.2006 16:27:40:
> I have been able to reproduce the issue, but in the meanwhile Java
> mapscript began crashing on msDrawMap so I am now working on that too.
>
> Regards,
> Umberto
>
> On 4/10/06, Umberto Nicoletti <umberto.nicoletti at gmail.com> wrote:
> > So it seems that the special character gets passed correctly back and
> > forth between the Java and c code.
> >
> > I'll investigate.
> > Umberto
> >
> > On 4/10/06, Nicol Hermann <nicol at nicol.info> wrote:
> > > Hi Umberto,
> > >
> > > i include the class in my development environment and run it.
> > > Here are the generated output:
> > >
> > > Setting expression to: /StraÃe/
> > > Retrieving expression: /StraÃe/
> > >
> > > Nicol
> > >
> > >
> > > Am Montag, den 10.04.2006, 09:57 +0200 schrieb Umberto Nicoletti:
> > > > Thanks,
> > > > I'll look into this asap.
> > > >
> > > > Please try to compile this small Java class and run it (simply put
it
> > > > in mapscript/java/examples) and run like the DrawMap.java example.
I
> > > > use it only to prove that unicode strings are treated correctly by
the
> > > > JNI layer between Java and the native c code.
> > > >
> > > > Regards,
> > > > Umberto
> > > >
> > > > On 4/10/06, Nicol Hermann <nicol at nicol.info> wrote:
> > > > > Umberto,
> > > > >
> > > > > as announced in my previous mail some sample data to the
querybyattribut
> > > > > issue with Java Mapscript.
> > > > > Please excuse me that i send you this mail directly. It bounces
due to
> > > > > size limitation of the mailing list.
> > > > >
> > > > > I attached one ZIP file with a Shape File. This file contains 2
> > > > > features. One with 'KREIS_NAME' = 'Südliche Weinstraße' and one
with
> > > > > 'KREIS_NAME' = 'Mainz-Bingen'.
> > > > > QueryByAttribut (layer.queryByAttributes(map,"KREIS_NAME",
"/Südliche
> > > > > Weinstraße/", mapscriptConstants.MS_MULTIPLE);) with
'Mainz-Bingen'
> > > > > works fine the other one with the german umlauts (Südliche
Weinstraße)
> > > > > do not.
> > > > >
> > > > > As Oliver noted in his first mail the same query also works with
php
> > > > > mapscript and when we use this thing within an expression of a
mapFile.
> > > > >
> > > > > I also attached one mapFile and one java class which uses the
subset.shp
> > > > > and could be used to simulate the problem.
> > > > >
> > > > > Oliver uses a windows environment (win 2000 and ms 4.8.1). I use
a linux
> > > > > box (debian sarge and also ms 4.8.1). My language environment
is:
> > > > >
> > > > > nicol at emil:~$ echo $LANG
> > > > > de_DE at euro
> > > > >
> > > > > The behaviour is the same on both OS.
> > > > >
> > > > > Please let me know if you need further informations.
> > > > > Thanks you very much for working on this issue
> > > > > Nicol
> > > > >
> > > > >
> > > > > Am Freitag, den 07.04.2006, 15:08 +0200 schrieb Umberto
Nicoletti:
> > > > > > Oliver,
> > > > > > did you solve this issue?
> > > > > >
> > > > > > If not please send some sample data that I can use to work on
it.
> > > > > > Also I need know on which OS you are and the language
environment you use:
> > > > > >
> > > > > > echo $LANG (on unix/linux)
> > > > > >
> > > > > > 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.
> > > > > > >
> > > > > > > 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
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > >
> > >
> > >
> >
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060413/b52548f2/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jni.zip
Type: application/zip
Size: 3798 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060413/b52548f2/attachment.zip>
More information about the MapServer-users
mailing list