RE: [OpenMap Users] Displaying CADRG

From: Chris Allport <chris.allport_at_red-inc.us>
Date: Thu, 21 Apr 2005 15:20:44 -0400

Jimmy-

I ran into something like this. It actually broke backwards compatibility
with libraries!

Try this:

--
ProjectionFactory pf = ProjectionFactory.getInstance();
pf.loadDefaultProjections();
Projection proj = pf.makeProjection(...
--
Despite the two or three ways I tried it, and the two or three places I
specified CADRG, I kept getting Mercator.
Hope this helps-
Chris
--
Chris Allport
Unmanned Systems Research & Development Lab
Patuxent River Naval Air Station
Phone: (301) 904-5943
-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]On
Behalf Of James R Erickson
Sent: Thursday, April 21, 2005 12:56 PM
To: Don Dietrick
Cc: OpenMap Mailing List
Subject: Re: [OpenMap Users] Displaying CADRG
Don,
Thanks that did the trick. Now another issue related has popped up. I'm
able to display the CADRG map using the openmap.bat file but when I try
it inside my application I'm having some trouble with the initial map
being set to Mercator. I specify CADRG both in my code and in the
properties file and I still end up with a Mercator projection. I know
the default is Mercator but I thought setting it in both places should
do the trick. Any thoughts? Here is a snippet of my code.
    public void initMap( int width, int height )
    {
        LOGGER.entering( OpenMap.class.getName(), "initMap" );
        // load the open map properties
        String fileName = getMapPreferences().getMapServiceProperties();
        if ( fileName == null || fileName.length() == 0 )
            fileName = PROPERTIES;
        loadProperties( fileName, _props );
        // create the image server
        _imageServer = new ImageServer( _props );
        // set the background color from properties
        String bgColor = _props.getProperty("BackgroundColor",
BACKGROUND_COLOR);
        _imageServer.setBackground( ColorFactory.parseColor( bgColor) );
        // create the projection
        String projection = _props.getProperty( "Projection", PROJECTION );
        _proj = (Proj)ProjectionFactory.makeProjection( projection,
            0f, 0f, 3000000000f, width, height );
        LatLonPoint ulLatLon = new LatLonPoint( MAX_LATITUDE,
MIN_LONGITUDE );
        LatLonPoint lrLatLon = new LatLonPoint( MIN_LATITUDE,
MAX_LONGITUDE );
        Point ulPoint = new Point( 0, 0 );
        Point lrPoint = new Point( _proj.getWidth(), _proj.getHeight() );
        double scale = _proj.getScale( ulLatLon, lrLatLon, ulPoint,
lrPoint );
        _proj.setMaxScale( (float) (scale * 1.5) );
        _proj.setScale( (float) scale );
        LOGGER.log( Level.FINER, "Image Server Projection: " + _proj );
        LOGGER.exiting( OpenMap.class.getName(), "initMap" );
    }
.......
.......
   private Proj _proj;
   private ImageServer _imageServer;
   private Properties _props = new Properties();
   private static String BACKGROUND_COLOR = "FF89C5F9";
   private static String PROJECTION = "com.bbn.openmap.proj.CADRG";
   private static String PROPERTIES = "openmap.properties";
And this is from my openmap.properties file:
openmap.Projection=com.bbn.openmap.proj.CADRG
This is what my logging statement provides:
FINER: Image Server Projection: Mercator[ world(421,0) radius=6378137.0
ppm=3272 center(0.0,0.0) scale=3.11336256E8 maxscale=3.12203456E8
minscale=62.0 width=420 height=280]
Jimmy Erickson
Software Engineer
Raytheon Garland IIS
972-205-6893
Don Dietrick wrote:
> Hi James,
>
> The first thing I would try is to change the map projection to the
> CADRG or LLXY projection (Navigate Menu -> Projection -> CADRG or
> LLXY).  You'll probably have to zoom over the area with the data,
> look for matching the scale of the map with the scale of the desired
> chart.
>
> - Don
>
> On Apr 20, 2005, at 5:16 PM, James R Erickson wrote:
>
>> All,
>> I'm new to OpenMap so please bear with me. I'm trying to display
>> some CADRG data using the openmap.bat file as a simple test. I keep
>> getting "RpfLayer requires an Equal Arc projection (CADRG/LLXY) for
>> images or attributes!" in the dialog pane and the layer doesn't  ever
>> show up. I can see the coverage of the area using the coverage  tool
>> but I don't ever see that actual layer. The A.TOC seems to  work
>> fine. I tried creating a new one (using the MakeTOC class)  just to
>> try it out but got the same results. My RPF settings are  below.
>> Please let me know if I need to change a setting somewhere  else or
>> another route to take. Thanks in advance.
>>
>> ### Java RPF properties
>> jrpf.class=com.bbn.openmap.layer.rpf.RpfLayer
>> jrpf.prettyName=CADRG
>> # This property should reflect the paths to the RPF directories
>> jrpf.paths=data/CADRG/RPF
>> # Number between 0-255: 0 is transparent, 255 is opaque
>> jrpf.opaque=255
>> # Number of colors to use on the maps - 16, 32, 216
>> jrpf.number.colors=216
>> # Display maps on startup
>> jrpf.showmaps=true
>> # Display attribute information on startup
>> jrpf.showinfo=false
>> # Scale images to fit the map scale
>> jrpf.scaleImages=true
>> jrpf.imageScaleFactor=4
>> jrpf.killCache=true
>> jrpf.chartSeries=ANY
>> jrpf.autofetchAttributes=false
>> jrpf.coverage=true
>> jrpf.subframeCacheSize=1
>> jrpf.auxSubframeCacheSize=1
>>
>> --
>> Jimmy Erickson
>>
>> --
>> [To unsubscribe to this list send an email to "majdart_at_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_at_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_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Thu Apr 21 2005 - 15:21:54 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:06 EDT