Problem drawing image with java/mapscript when starting with a blank mapObj

Umberto Nicoletti umberto.nicoletti at GMAIL.COM
Sat Jul 8 06:11:17 EDT 2006


Please open an issue on mapserver bugzilla.
I'll look into ti asap.

Umberto

On 7/7/06, James Dracup <jamesdracup at hotmail.com> wrote:
> 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 I'd 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 mapObj's 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