NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[visad] Convert java.awt.image from Web Map Server to a FlatField

Hi All,



...Tavi and I got a question about how to convert a java.awt.image from
an OGC Web Map Server (WMS) [1] or a Web Coverage Server [2] to a
FlatField..:

Our problem:

1. Web map servers render a map as an image from different geospatial
datasets (raster and vector). We want to request a geotiff image (grey
values) from the server and interpret this as a digital elevation model
(or better, as a function (latitude, longitude)---> altitude).
2. To connect to the service, we use vividsolution's JUMP library [3],
[4] - (Java Uniform Mapping Platform)
We initialize the service with jump like this:

WMService ourWMS = new WMService(URL);
MapRequest OurReq = ourWMS.createMapRequest();

and finally request the image with

OurReq.getImage();

The return value of OurReq.getImage() is a java.awt.image that we now
want to convert into a VISAD data object.

We then use DataUtility to create a FlatField:
imageField = DataUtility.makeField(image);

This imageField
    System.out.println("FuncType = " + imageField.getType().prettyString());
    System.out.println("Range dimension in refresh is " +
imageField.getRangeDimension());

now has a function type (image row, image column) --> (r,g,b)

That means, java.awt.image is a 24bit image rather than the 8bit or 16
bit grey value tiff we originally requested.

Does someone have a good idea to create an appropriate FlatField, or is
this even a wrong way to deal with it?

Furthermore -- I think a VISAD wiki could help as a documention and FAQ
platform -- what do you think?

Thanks in advance for your ideas and suggestions,

Tavi and Chris


[1] http://www.opengeospatial.org/standards/wms
[2] http://www.opengeospatial.org/standards/wcs
[3] http://www.vividsolutions.com/jump/
[4] http://www.jump-project.org





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