[OpenMap Users] ImageServer

From: Gubler, Rüdiger <rgubler@init-ka.de>
Date: Thu Feb 20 2003 - 02:58:49 EST

Hello,

I use the following code to get an image:

              ImageFormatter imageFormatter = null;
                Projection proj = null;
                Vector layerVec = null;
                Layer[] layers = null;
                byte[] data = null;

                layerVec = new Vector();
                layerVec.add(new WayLayer("Ways"));
                layerVec.add(new AreaLayer("Urban", GisUrbanArea.class));

                layers = (Layer[]) layerVec.toArray(new Layer[layerVec.size()]);
                imageFormatter = new SunJPEGFormatter();
                ((SunJPEGFormatter) imageFormatter).setImageQuality(1f);

                proj = ProjectionFactory.makeProjection(projType, latitide, longitude, scale, width, hight);

                ImageServer imageServer = new ImageServer(layers, imageFormatter);
                imageServer.setDoAntiAliasing(true);
                data = imageServer.createImage(proj, -1, -1);

                try
                {
                        OutputStream fos = new FileOutputStream("C:/GisImageTest/Test.jpg");
                        fos.write(data);
                        fos.close();
                }
                catch (FileNotFoundException fnfex)
                {
                        Logger.defaultLogger.log(Level.ERROR, fnfex.getMessage(), fnfex);
                }
                catch (IOException ioex)
                {
                        Logger.defaultLogger.log(Level.ERROR, ioex.getMessage(), ioex);
                }

The problem is that only the background is painted and the Layers (which worked great in a MapBean) do nothing. I have added some
logmessages into the computeGraphics() method of the layers.

What is going wrong?

Yours Rüdiger

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Feb 20 03:01:33 2003

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:34 EDT