unable to get raster values ?

Frank Warmerdam warmerdam at POBOX.COM
Sun Sep 26 16:23:25 EDT 2004


temiz wrote:
> despite all my efforts, I cannot the solve the problem.
> I just want to get raster map value where I have clicked.
> I can display it and get value from polygon layer but not from
> raster layer concerned.
> Instead I get an error message concerning line "**" :
> "MapServer Error]: msQueryByPoint(): No matching record(s) found."
>
> ////raster
>                     $heylayer ->set("status",1);
>
>              **     if ($heylayer->queryByPoint($pt, MS_SINGLE, 180.0)
> == MS_SUCCESS) {
>                     // find out how many results we found
>                     $heylayer->open();
>                     // find out how many results we found
>                      for ($i = 0; $i < 1000; $i++) {
>                      // get the results we need from the layer
>                     $res_hey = $heylayer->getResult($i);
>                       // get our shape info from the index
>                      $heyData =
> $heylayer->getShape($res_hey->shapeindex, $res_hey->tileindex);
>
>
>                     $hey_vars=get_object_vars($heyData);
>                     //$heylayer->close();
>                     while (list($key,$value)=each($hey_vars)) :
>                     print "$key ==> $value<br>";
>                    endwhile;
>                    //////end rast

Ahmet,

I don't think I have been following your earlier email on this topic very
closely.  Are you using MapServer 4.3?  Raster query is not available in
earlier versions.  Do you have a template on your raster layer that you want
to be queriable?  This marks it as queriable even if you don't actually use
the template.  The filename listed in the TEMPLATE statement does not even
need to exist.

Also, you should review the RasterQuery topic in the Wiki at:

   http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?RasterQuery

You might also want to look at the raster query test script.  It can be
found in msautotest/mspython/rqtest.py in MapServer CVS.  It may be a useful
example of what needs to be done from mapscript (python in that case).

If you have looked into all these issues, and you still can't get it to work,
let me know and provide a minimal example of your situation I can try and use
to look into the problem.

--
---------------------------------------+--------------------------------------
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