- To: visad@xxxxxxxxxxxxxxxx
- Subject: technique for changing map projections within a display??
- From: Stuart Maclean <stuart@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 08 Aug 2005 14:57:18 -0700
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
- Follow-Ups:
- Re: technique for changing map projections within a display??
- From: Don Murray
- Re: technique for changing map projections within a display??
- From: Don Murray
- Re: technique for changing map projections within a display??
- From: Bill Hibbard
- Re: technique for changing map projections within a display??