[OpenMap Users] Image Creation Servlet Code

From: Don Dietrick <dietrick@bbn.com>
Date: Fri May 28 2004 - 14:16:24 EDT

Here's a pointer to servlet code that was posted earlier on the mailing
list, but it's kind of buried:

http://openmap.bbn.com/mailArchives/openmap-users/2004-04/2809.html

I've changed the header of this message to make this pointer easier to
find.

- Don

On May 28, 2004, at 10:19 AM, Christian Weaves wrote:

> Thanks for that Brian, I now have the projection sorted.
>
> The problem I have now is that the map displayed is the whole world and
> not zoomed into my specified scale/lat & long.
>
> The map is created with the following line:
> MapRequestHandler iServer = new MapRequestHandler(mapProps);
>
> I then want to zoom to a specific scale/lat & lot so I use:
> iServer.handleRequest("REQUEST=MAP&PROJTYPE=Mercator&SCALE=180127&LAT=3
> &LON=4&WIDTH=500&HEIGHT=500");
>
> Then I output the image to the browser with:
> OutputStream os = response.getOutputStream();
> os.write(iServer.createImage(iServer.getDefaultProjection()));
>
> But rather than the image zooming in to my scale/lat & long all I get
> is
> the complete map of the world.
>
> I don't want to use the SimpleHttpImageServer, I want to keep it
> contained in the servlet container.
>
> Any ideas?
>
> Thanks again.
>
>
>
>
>
>
>
>
>
> On Fri, 2004-05-28 at 14:42, Hudson Brian R Contr AFRL/IFSF wrote:
>> Hello,
>>
>> The
>> com.bbn.openmap.image.ImageServerUtils.createOMProjection(properties,
>> Projection) will show you how to construct a Projection. It uses the
>> ProjectionFactory.makeProjection method.
>>
>> In fact, this is the method that is used by the MapRequestHandler in
>> order
>> to create the Projection based on the http request.
>>
>> Hopes this helps,
>>
>> Brian Hudson
>>
>> -----Original Message-----
>> From: owner-openmap-users@bbn.com
>> [mailto:owner-openmap-users@bbn.com] On
>> Behalf Of Christian Weaves
>> Sent: Friday, May 28, 2004 9: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=6
>> 4.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"]
>
> --
> [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"]
>
>

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Don Dietrick, dietrick@bbn.com
BBN Technologies, Cambridge, MA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

--
[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 14:18:56 2004

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