RE: [OpenMap Users] servlet example

From: Martin Chapman <martin.chapman@softwize.net>
Date: Wed May 14 2003 - 17:05:46 EDT

Also here is the x,y conversion code in the servlet:

private LatLonPoint getLatLonFromXY( HttpServletRequest request,
                                         int nX,
                                         int nY ) throws
ServletException, IOException
    {
        try
        {
            int nProjectionType = ProjectionFactory.getProjType(
getProjectionType( request ) );
            Projection oProjection = ProjectionFactory.makeProjection(
nProjectionType,
 
getLatitude( request ),
 
getLongitude( request ),
        
getScale( request ),
 
getWidth( request ),
 
getHeight( request ) );

            return oProjection.inverse( nX, nY );
        }
        catch( Exception e )
        {
             throw new ServletException( e.getMessage() );
        }
    }
}

Martin Chapman

-----Original Message-----
From: owner-openmap-users@bbn.com [mailto:owner-openmap-users@bbn.com]
On Behalf Of David Garnier
Sent: Wednesday, May 14, 2003 1:52 PM
To: openmap-users@bbn.com
Subject: RE: [OpenMap Users] servlet example

Le mar 13/05/2003 à 19:46, Keith Alphonso a écrit :
> Generating the map via servlet is relatively simple, making it
> clickable is a little bit more difficult. The approach we took was to

> create a servlet for generating the map, then we created a servlet
> that would convert X/Y coordinates into Lat/Lon based on that map's
> settings. We used the Projection.inverse method to convert the X/Y to

> Lat/Lon. Then you can use the servlet map image as an input field in
> your HTML to send the X/Y via click.

I've been using the ismap attribute of the IMG tag. It adds the
coordinates of the cursor on the map to the url of the image, if there
is one. It works quite well and is supported since HTML 2.0. Still, it
is a little tricky to use, so I think that I will try your idea. Thanks.

Best Regards

-- 
David Garnier <david.garnier@etudier-online.com>
--
[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 Wed May 14 17:05:24 2003

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