Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-users] Getting raster data from a wms layer

I would ask on the GeoServer list if getInfo could be hooked up to work for raster layers. Have you tried the info tool? It retrieves information from a WMS about the layer(s) the user has clicked on - it is covered in walkthrough 1.

Other then the GetInfo operation the WMS specification does not provide any facilities for performing a query.

Jody

On 03/09/2009, at 1:55 AM, Devrim Baris Acar wrote:

Hi,
I have setup a geoserver which serves nasa srtm30 bathymetry elevation data(geotiff) in pyramids.

I have added this as a wms layer to udig but stuck on the point to read the raster value on a mouse clicked point. For a local geotiff file, the following code seems to work ok but I dont know what should I do for a wms layer as its georesource is not of GridCoverage2D class.

What should I do to access raster data values on a wms (or wmsc) layer?

Best regards,
Devrim Baris Acar

---------------------------
//works for local geotiff
public float getElevationOfPoint2(int x, int y) {

        ILayer layer = getContext().getMapLayers().get(0);
        GridCoverage2D geoRes = null;
        try {
            geoRes = (GridCoverage2D) layer.getGeoResource().resolve(
                    GridCoverage.class, new NullProgressMonitor());
        } catch (IOException e) {
            e.printStackTrace();
        }

DirectPosition dp = new DirectPosition2D (geoRes.getCoordinateReferenceSystem(), start.x, start.y); // start is of type Coordinate
        int[] evaluate = (int[]) (geoRes.evaluate(dp));
        return new Float(evaluate[0]);

    }
---------------------------



_______________________________________________
udig-users mailing list
udig-users@xxxxxxxxxxxxxxxxxxxxx
http://lists.refractions.net/mailman/listinfo/udig-users



Back to the top