See my reply under each question, and the links at the bottom have all the code you need from web page to servlet and back.
Martin
-----Original Message-----
From: h0119153@hkusua.hku.hk [mailto:h0119153@hkusua.hku.hk]
Sent: Tue 3/9/2004 6:35 PM
To: openmap-users@bbn.com
Cc:
Subject: [OpenMap Users] Lan Lon of upper left corner
Hi, I am trying to display SHAPE map in a servlet with openmap.
Here is my question:
1) I would like to know the lan and lon of the location in the map image when a
user clicks his mouse on the map, how can I do this?
>>Get the x, y mouse position from either http or javascript and pass to the servlet.
2) Actually, I know that I can get the mouse position on the image by http, but
how can I translate the position of mouse on the image to the actual lan and
lon?
>> create a Projection class passing the width, height (in pixels) of your map, the center lat/lon of the map and the name of the desired projection (like "LLXY"- you may need the type id like 2 or 3).
>>Use the projections inverse(x, y) and forward(lat, lon) methods to switch back and forth between lat/lon and x,y.
I think I know the mathematics to calculate the real lat and lon provided that I
know the upper left corn's lan and lon. How can I get those 2 values?
>> use Projection.forward(lat, lon) and Projection.inverse(x,y)
3) Also, I am using MapRequesHandler to produce the map upon request. How can I
add a layer which shows the .dbf content of the map?
>> see my postings for all the code you need....
http://openmap.bbn.com/mailArchives/openmap-users/2003-05/1552.html
http://openmap.bbn.com/mailArchives/openmap-users/2003-05/1553.html
http://openmap.bbn.com/mailArchives/openmap-users/2003-05/1551.html
Thank you for your kind attention and help!
Steve
--
[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 Tue Mar 9 22:55:32 2004
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:38 EDT