technique for changing map projections within a display??

Using the visad/examples/MapProjectionDisplay as a template, I have learned how to do map projections is VisAD. My preferred projection classes are the ones from IDV, i.e. ucar.unidata.geoloc.projection.*, with the ucar.visad.ProjectionCoordinateSystem the bridge to the visad classes.

Now I'd like to change map projections within a display, say from a Lambert to a Mercator. Trying this, I first remove scalar maps for RealType.Latitude and RealType.Longitude from my DisplayImpl (J2D). But then when I try to build a new DisplayTupleType with DisplayRealTypes from the example visad app, I get errors. Seems like a DisplayRealType must be uniquely named. To get around this, I just make sure that the N'th time I set the display coord sys, I name the DisplayRealType with N in the name. I did think about just catching the TypeException and continuing regardless but was unsure of the ramifications.

I also tried keeping the display real types and just building a new tuple type for each map projection, but that failed with a 'display real type already in a tuple' error.

Can anyone explain why such types must be uniquely named? On a related note, is it a waste to be building 3 display real types and a displaytupletype every time I want a new display side coordinate system, i.e. a new map projection?? Is there a better way to achieve my goal. I note that what I really want is a setCoordinateSystem on my DisplayTupleType, then I wouldn't even have to remove the scalar maps at all (??)

Hmm, it's just dawned on me that IDV allows in-display map projections on the fly, can anyone enlighten me there?

Any help appreciated.

Stuart


  • 2005 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: