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

Tamas Szekeres szekerest at gmail.com
Sun Sep 27 14:10:04 PDT 2009


Hi,

According to http://mapserver.org/input/raster.html#raster-query
I suspect those values could be retrieved as the "red", "green" and "blue"
attributes of the returned features.

Best regards,

Tamas



2009/9/27 Ahmet Temiz <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 = slplayer.getResult(j);
>                slplayer.open();
>                shapeObj shape = new shapeObj(slplayer.getType()
>                                .swigValue());
>                int s = slplayer.getShape(shape,
> resultMember.getTileindex(),
>                                resultMember.getShapeindex());
>
>               System.out.println(" *** s "+s);   -----> 0
>
>
>                if (shape != null) {
>
>                System.out.println(" *** numResults "+numResults); ----> 2
>
>                int shpix = shape.getIndex();
>
>                System.out.println(" *** shpix "+shpix);  ! -------> -1
>
>                System.out.println(" *** shape.getValue
> "+shape.getValue(j));  -----> only
> gives x,y values bot not RGB values
>
>                }
>                slplayer.close();
>        }
>
> here is the related part of map file :
>
> LAYER
>  NAME "slp_cat"
>  STATUS OFF
>  TILEINDEX "/home/orkun/data/hsunucu/mapshar/rast_index.shp"
>  TILEITEM "Location"
>  TYPE RASTER
>  TEMPLATE "/home/orkun/workspace2/pro1/WebContent/Raster_Query.html"
>  PROCESSING "SCALE=1,9"
>  #PROCESSING "SCALE_BUCKETS=9"
>  CLASS
>    NAME "0-5"
>    EXPRESSION ([pixel] =1)
>    STYLE
>      COLOR 254 254 25
>    END
>  END
>
>  CLASS
>    NAME "5-10"
>    EXPRESSION ([pixel] =2)
>    STYLE
>      COLOR 249 177 20
>    END
>  END
>   CLASS
>    NAME "10-15"
>    EXPRESSION ([pixel] =3)
>    STYLE
>      COLOR 25 254 82
>    END
>  END
>
>   CLASS
>    NAME "15-20"
>    EXPRESSION ([pixel] =4)
>    STYLE
>      COLOR 25 254 225
>    END
>  END
>
>  CLASS
>    NAME "20-25"
>    EXPRESSION ([pixel] =5)
>    STYLE
>      COLOR 25 140 254
>    END
>  END
>
>  CLASS
>    NAME "30-35"
>    EXPRESSION ([pixel] =6)
>    STYLE
>      COLOR 53 25 254
>    END
>  END
>
>  CLASS
>    NAME "35-45"
>    EXPRESSION ([pixel] =7)
>    STYLE
>      COLOR 196 25 254
>    END
>  END
>
>  CLASS
>    NAME "35-45"
>    EXPRESSION ([pixel] =8)
>    STYLE
>      COLOR 254 25 169
>    END
>  END
>
>  CLASS
>    NAME "45-90"
>    EXPRESSION ([pixel] =9)
>    STYLE
>      COLOR 254 25 25
>    END
>  END
>
>  END
>
> ~~~~~~~~~~~~~~~~~
>
>  Could you possibly tell me where I am wrong ?
>
>  kind regards
>
> --
> Open WebMail Project (http://openwebmail.org)
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090927/3f8f03ff/attachment.htm>


More information about the MapServer-users mailing list