Problem drawing image with java/mapscript when starting with a blank mapObj
James Dracup
jamesdracup at HOTMAIL.COM
Fri Jul 7 09:58:12 PDT 2006
Hello,
I am using java/mapscript embedded inside a java program and am having a few
problems. I wonder if anybody has any suggestions, or if it is something
obvious I have missed?
I create a new mapObj in java, but NOT from a .map file, a blank one:
mapObj mapobj = new mapObj(null);
There is then a fairly long and complicated chunk of code to populate that
mapObj from a db and user input with settings and layers etc. etc.
I finally do:
byte[] bytes = mapobj.draw().getBytes();
Intending to then further process in java the image returned.
However, I always get a blank (just background colour) image. Initially I
thought Id missed something out when setting the parameters for the various
mapscript objects, but, having looked at that for a while, I now do not
think that is the problem.
If I do a mapobj.save("MapFileName.map") - the .map file outputted is
perfect, and works fine (displays a map) in all contexts (cgi-bin, java
mapscript).
I can load that .map file into a new mapObj, and the image produced is fine:
mapObj newmapobj = new mapObj("MapFileName.map");
byte[] bytes = newmapobj.draw().getBytes();
If I then do a newmapobj.save("MapFileToCompare.map") - the .map file
outputted is absolutely and completely identical (did a diff) to the
original one outputted.
So I am really confused - it seems to me the mapObjs are identical - so why
do I need to go via the file system in order to produce an image? What
changes, and how can I avoid it?
Any thoughts,
Thanks,
James
More information about the MapServer-users
mailing list