Getting raster data from a wms layer

2 messages Options
Embed this post
Permalink
Devrim Baris Acar

Getting raster data from a wms layer

Reply Threaded More More options
Print post
Permalink
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
[hidden email]
http://lists.refractions.net/mailman/listinfo/udig-users
Jody Garnett-2

Re: Getting raster data from a wms layer

Reply Threaded More More options
Print post
Permalink
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
> [hidden email]
> http://lists.refractions.net/mailman/listinfo/udig-users

_______________________________________________
udig-users mailing list
[hidden email]
http://lists.refractions.net/mailman/listinfo/udig-users