Re: orthophoto over dem

Hi Andrea-

I haven't been following this thread too closely, but I have
a few comments.

Andrea Antonello wrote:
Bill, thanks for that. The lightbulb in my head finally lit up.

I made a small adaption to the GIFAdaptor to take care of the
positioning in the geographic space.
At that point the combining of the FlatFields worked flawless.

I would avoid making changes to the GIFAdapter. Instead,
read in your image, create the appropriate coordinate system,
then create a new domain set with the coordinate system and
then a new FlatField with the new domain:

    FlatField ff = GIFAdapter.getData();
    Linear2DSet domain = (Linear2DSet) ff.getDomainSet();
    RealTupleType domainType = ((SetType)domain.getType()).getDomain();
    // make the coordinate system - coordsys
    RealTupleType newType
       new RealTupleType(
            domainType.getRealComponents(), coordsys, null);
    Linear2DSet newDomain
           new Linear2DSet(newType,
               new Linear1DSet[] {domain.getX(), domain.getY()});
    FunctionType newFType
      new FunctionType(newType,
    FlatField ffWithCS = new FlatField(newFType, newDomain);
    ffWithCS.setSamples(ff.getSamples(false), false);

(note I haven't compiled the above, but it should give you
the idea).

BTW, the Unidata IDV (
already has functionality to overlay images on topography like
you are trying to do.  It basically uses the same technique
above with Bill's combine method.  An example exercise is
available in our Training Workshop:

using an image from a web map server and a USGS DEM.

I put the result and the code here:

There will be need for optimization of the code, but it works.

It looks like the JGrass project is doing some nice work.

I found that image is read flipped against the geographic position, so I
did a workaround on the colorarrays.
Has anyone a better solution for the flipping?

I'm guessing that you have your CS backwards (line and element

Don Murray                               UCAR Unidata Program
dmurray@xxxxxxxxxxxxxxxx                        P.O. Box 3000
(303) 497-8628                              Boulder, CO 80307

To unsubscribe visad, visit:

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