[OpenMap Users] ProjMath.getScale

From: Catania, Luke A ERDC-TEC-VA <Luke.A.Catania@erdc.usace.army.mil>
Date: Mon Aug 25 2003 - 15:40:53 EDT

First let me say, that, I presume zooming to a box represented exactly by
two corner points is not possible due to the fact that we are not dealing
with a flat world with distance from latitude to latitude and longitude to
longitude not being the same.
 
I have implemented two new Coordinate panels for the CoordDialog class. As
in the existing panels, where there is the ability to enter a point in
either decimal degrees or in DMS depending upon the tab you select, my
additions allow a user to specify an AOI by entering in lower left and upper
right coordinates either in decimal degrees or DMS. I calculate the center
by averaging the coordinates. And I calculate the new scale using the
corner coordinates and the getScale method. My code to center and scale is:
 
 
        Proj projection = (Proj)map.getProjection();
        float newScale =
com.bbn.openmap.proj.ProjMath.getScale(llLatLonPoint,
                                                       urLatLonPoint,
                                                       projection);
        projection.setScale(newScale);
        projection.setCenter(lat, lon);
        map.setProjection(projection);
 
When I enter the AOI coordinates and apply, my map is centered properly, but
not necessarily zoomed to show all of the AOI.
 
For example, if my AOI is:
 
UrLat 43.0
UrLon 23.0
 
LlLat: 40.0
LlLon: 20.0
 
the map shows all of 20 -23 in longitude plus more outside that range, but
is just inside the 40-43 range. Not that big of a deal, but in the case of:
 
 
UrLat 44.0
UrLon 23.0
 
LlLat: 38.0
LlLon: 20.0
 
My map zooms to cover just inside 18-25 Lon and 39.5 - 42.5 Lat, so I do not
get an AOI that includes all 38 - 43 in Lat. Is that that all caused by the
projection. I am using CADRG, if I tried LLXY, which then includes the AOI
I entered from lower lat to upper lat, but goes from 16-26 in long.
 
I do not know much about projections, but I presume this again is all due to
the fact that we are not dealing with a flat world with distance from
latitude to latitude and longitude to longitude not being the same. So how
does new scale work.
 
I just want to make sure it is not a bug I have introduced in my code and I
at least want all of the AOI included even if it includes more outside my
AOI.
 
Thanks,
Luke
 
 

--
[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 Mon Aug 25 16:06:10 2003

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