[mapserver-users] couldn't get value from raster map

Frank Warmerdam warmerdam at pobox.com
Sun Sep 27 17:24:57 EDT 2009


> 2009/9/27 Ahmet Temiz <temiz at deprem.gov.tr <mailto:temiz at deprem.gov.tr>>
> 
>     hello
> 
>     I am using java mapscript and trying to get values from raster layer.
> 
>     But I can only get x,y values but not other values especially color
>     values of
>     the pixel I had clicked.
> 
>     here is the my code's fragment :
> 
>     int q = slplayer.queryByPoint(map0, qpt, mapscript.MS_MULTIPLE, 10.0 );
>     int numResults = slplayer.getNumResults();
> 
>     if (numResults != 0) {
>            for (int j = 0; j < numResults; j++) {
>                    resultCacheMemberObj resultMember =
...
>                    System.out.println(" *** shape.getValue
>     "+shape.getValue(j));  -----> only
>     gives x,y values bot not RGB values

Ahmet,

As I read this code, you are looking for field "j" of the shape, but
j is actually the index into the resultset, not anything to do with fields.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



More information about the mapserver-users mailing list