RE: [OpenMap Users] MapRequestHandler.createImage problem

From: Keith Alphonso <kalphonso@diamonddata.com>
Date: Fri May 28 2004 - 11:14:37 EDT

I use the following code to create a projection:

    /** Calc projection from default scale */
    Projection proj = ProjectionFactory.makeProjection(
      projType,
      (float)pt.getLatitude(),
      (float)pt.getLongitude(),
      map.getScale(),
      map.getWidth(),
      map.getHeight());

I use the imageServer to create the map image as follows:

        ImageServer imageServer = new ImageServer(tprops);
        com.bbn.openmap.image.SunJPEGFormatter formatter = new
com.bbn.openmap.image.SunJPEGFormatter();
        formatter.setImageQuality(1.0f);
        imageServer.setFormatter(formatter);
        byte [] imageBytes = imageServer.createImage(getMapProjection(map,
tprops));
        return imageBytes;

That way I control everything on the map is through the properties passed to
the imageServer. All of the rest of my application is geared towards
changing those properties to do what I want (turn layers on/off,
zoom-in/out, Add layers, etc.) Works pretty well for me, I've found that I
can handle pretty much everything I need to through properties.

-----Original Message-----
From: Christian Weaves [mailto:christian.weaves@fugro-robertson.com]
Sent: Friday, May 28, 2004 8:20 AM
To: openmap-users@bbn.com
Subject: [OpenMap Users] MapRequestHandler.createImage problem

Hi, Can someone please tell me how I use the createImage method in the
MapRequestHandler object correctly.

I have a servlet (CreateMapImage.java) that is supposed to generate a map
image using the OpenMap api and send the result to the servlets response
object.

The MapRequestHandler.createImage method accepts a Projection class as a
parameter, I can't for the life of me create a new Projection object to pass
as a parameter..

Can you point me in the right direction??

Thanks very much, here's the Servlet code:

=======================================================================

public void doPost(HttpServletRequest request, HttpServletResponse
response)
    throws ServletException, IOException {

        response.setContentType("image/jpeg");

        MapRequestHandler iServer = new MapRequestHandler(mapProps);

        //some dummy coords
        String imageRequest =
"REQUEST=MAP&PROJTYPE=Mercator&SCALE=180127&WIDTH=770&HEIGHT=540&LAT=64.4718
5&LON=6.161536";

        OutputStream os = response.getOutputStream();
        
        iServer.handleRequest(imageRequest);
                

        //problem line, can't create image
        os.write( iServer.createImage(***********) );
}
                
                

--
[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"]
--
[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 Fri May 28 11:15:43 2004

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