<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<STYLE>BODY {
        FONT-SIZE: 12px; FONT-FAMILY: Arial, Helvetica, sans-serif
}
</STYLE>

<META content="MSHTML 6.00.2900.5945" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=117442011-02062010>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=117442011-02062010></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2><SPAN 
class=117442011-02062010><FONT color=#000000>LAYER TEMPLATE 
"dummy.html"?</FONT></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000000 size=2><SPAN 
class=117442011-02062010></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#000000 size=2><SPAN 
class=117442011-02062010>Does such a thing exist? Have you tried with 
plain</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000000 size=2><SPAN 
class=117442011-02062010>&nbsp;TEMPLATE "dummy.html"?</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000000 size=2><SPAN 
class=117442011-02062010></SPAN></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><FONT color=#000000 size=2><SPAN 
class=117442011-02062010>-Jukka Rahkonen-</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff size=2><SPAN class=117442011-02062010><FONT 
color=#000000></FONT>&nbsp;</DIV>
<DIV dir=ltr align=left><BR></DIV></SPAN></FONT><BR>
<BLOCKQUOTE dir=ltr 
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader lang=fi dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>Lähettäjä:</B> 
  mapserver-users-bounces@lists.osgeo.org 
  [mailto:mapserver-users-bounces@lists.osgeo.org] <B>Puolesta </B>Tom van der 
  Putte<BR><B>Lähetetty:</B> 2. kesäkuuta 2010 13:34<BR><B>Vastaanottaja:</B> 
  Frank Warmerdam; Alexander Petkov<BR><B>Kopio:</B> 
  mapserver-users@lists.osgeo.org<BR><B>Aihe:</B> Re: Re: [mapserver-users] 
  Mapscript Rasterquery returns empty result<BR></FONT><BR></DIV>
  <DIV></DIV>Hi Frank, Alexander,<BR><BR>Again thanks for your reply; I've been 
  abroad for a month and haven't had time to check it out. However, I've ben 
  doing some work on it today, and tested the following:<BR><BR>I made a test 
  tiff, with 2 large areas surrounded by NoData. When clicking anywhere in any 
  one of the 2 big areas I get the response:<BR><CODE 
  class="wrappedText focusRow" role="listitem"><BR>{"_handle_":Resource id 
  #47,"numlines":1,"type":0,"index":-1,"tileindex"</CODE><CODE 
  class="wrappedText focusRow" 
  role="listitem">:-1,"classindex":0,"numvalues":8,"text":"","bounds":{"_handle_":Resource 
  id #48,"minx":401265.0032,"miny"</CODE><CODE 
  class="wrappedText &#13;&#10;focusRow" 
  role="listitem">:633815.31,"maxx":401265.0032,"maxy":633815.31},"values":[null,null,null,null,null,null,null,null]}<BR></CODE><BR>When 
  I click on any nodata area the response is&nbsp; <PRE role="list">Warning: [MapServer Error]: msQueryByPoint(): No matching record(s) found. in C:\ms4w\apps\fusion\MapServer\php\GetRasterPoint.php on line 36<BR>
Fatal error: [MapServer Error]: msRASTERLayerGetShape(): Out of range shape index requested. Requested 0 but only 0 shapes available. in C:\ms4w\apps\fusion\MapServer\php\GetRasterPoint.php on line 42<BR>
<BR>
<SPAN style="FONT-FAMILY: Arial">This behaviour follows the edges of the areas perfectly. Also I checked it out with fixed coord pairs, and it doesn't seem te related to CRS problems. I've also tried IMG instead of TIFF, but no difference there.<BR>
<BR>
As mentioned, I'm running mapscript 5.2.1, not 5.6. I'm don't know if this would make a difference, but perhaps someone could test this for me? <BR>
<BR>
The TIFF I use for testing is available from:  </SPAN><STYLE>BODY {
        FONT-SIZE: 12px; FONT-FAMILY: Arial, Helvetica, sans-serif
}
</STYLE>http://www.vdputte.nl/test_tiff.rar</PRE>*** For the MAP part of the mapfile, 
  I use the following (I removed most non-essential 
  things):<BR>&nbsp;&nbsp;&nbsp; EXTENT -1000000 -1200000 2902206 
  1773859<BR>&nbsp;&nbsp;&nbsp; IMAGETYPE PNG24<BR>&nbsp;&nbsp;&nbsp; SIZE 600 
  600<BR>&nbsp;&nbsp;&nbsp; STATUS ON<BR>&nbsp;&nbsp;&nbsp; UNITS 
  METERS<BR>&nbsp;&nbsp;&nbsp; NAME "Test_Map"<BR><BR>&nbsp;&nbsp;&nbsp; 
  PROJECTION<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  'proj=lcc'<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  'lat_1=52.67000000000002'<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  'lat_2=54.33'<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  'lat_0=48'<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  'lon_0=10'<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  'x_0=815000'<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  'y_0=0'<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  'ellps=intl'<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  'units=m'<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 
  'no_defs'<BR>&nbsp;&nbsp;&nbsp; END<BR><BR>*** For the test 
  LAYER:<BR><BR>&nbsp;&nbsp;&nbsp; LAYER<BR>&nbsp;&nbsp;&nbsp; &nbsp; NAME 
  "mask"<BR>&nbsp;&nbsp;&nbsp; &nbsp; DATA 
  "c:/ms4w/Apache/htdocs/data/rasters/depthmaps/tert_msk_rast.img"<BR>&nbsp;&nbsp;&nbsp; 
  &nbsp; TYPE RASTER<BR>&nbsp;&nbsp;&nbsp; &nbsp; STATUS ON<BR>&nbsp; 
  &nbsp;&nbsp;&nbsp; &nbsp; LAYER TEMPLATE "dummy.html"<BR>&nbsp;&nbsp;&nbsp; 
  &nbsp; CLASS<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NAME 
  "1"<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; EXPRESSION ([pixel] == 
  1)<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; STYLE<BR>&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; color 255 0 0 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; END&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &nbsp; END<BR>&nbsp;&nbsp;&nbsp; 
  &nbsp; CLASS<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; NAME 
  "2"<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; EXPRESSION ([pixel] == 
  2)<BR>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; STYLE<BR>&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; color 0 255 0 
  <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; END&nbsp;&nbsp;&nbsp; 
  &nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &nbsp; END<BR>&nbsp;&nbsp;&nbsp; 
  END#layer<BR><BR>*** For the querying script I use this:<BR><BR>$szLayer = 
  "mask"; <BR>$oLayer = $oMap-&gt;getLayerByName($szLayer); //get 
  Layer<BR>$oMap-&gt;prepareQuery();<BR><BR>// To be sure no CRS problems arise, 
  I use these coords, smack in the middle of the left area<BR>$x = 360429;<BR>$y 
  = 642536;<BR><BR>/* <BR>//For NoData, use<SPAN 
  style="FONT-FAMILY: Arial,Helvetica,sans-serif"><BR>$</SPAN>x = 759753;<SPAN 
  style="FONT-FAMILY: monospace"><BR></SPAN>$y = <CODE 
  class="wrappedText focusRow" role="listitem">935658;<BR>// for a point right 
  between the 2 areas<BR></CODE><SPAN 
  style="FONT-FAMILY: monospace"></SPAN>*/<BR><BR>$oPoint = ms_newPointObj(); 
  //Create Point<BR>$oPoint-&gt;setXY($x,$y);<BR><BR>$status = 
  $oLayer-&gt;queryByPoint($oPoint, MS_MULTIPLE, 1); //Query<BR>$status = 
  $oLayer-&gt;open();<BR>$result = $oLayer-&gt;getResult(0); //Get 
  Result<BR>$numResults = $oLayer-&gt;getNumResults();<BR><BR>$shape = 
  $oLayer-&gt;getShape($result-&gt;shapeindex,$result-&gt;tileindex); // 
  Retrieve shape<BR><BR>echo(var2json($shape)); //echo to browser<BR><BR><BR>Can 
  anybody confirm that they get the same 
  behaviour?<BR><BR>Cheers,<BR>Tom<BR><BR><BR><BR><SPAN 
  style="FONT-WEIGHT: bold">On Thu 29/04/10 16:07 , Frank Warmerdam 
  warmerdam@pobox.com sent:<BR></SPAN>
  <BLOCKQUOTE 
  style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(245,245,245) 2px solid; MARGIN-RIGHT: 0px">Tom 
    van der Putte wrote:<BR><SPAN style="COLOR: rgb(102,102,102)">&gt; 
    Hi,</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">&gt; </SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; I have the following 
    code:</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">&gt; </SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; 
    $oMap-&gt;prepareQuery();</SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; $oPoint = 
    ms_newPointObj();</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">&gt; 
    $oPoint-&gt;setXY($x,$y); //coords received from a AJAX call</SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; </SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; </SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; $oLayer = 
    $oMap-&gt;GetLayerByName($szLayer); //Name received from a AJAX 
    call</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">&gt; $status = 
    $oLayer-&gt;queryByPoint($oPoint, MS_MULTIPLE, 1);</SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; $status = 
    $oLayer-&gt;open();</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">&gt; 
    $result = $oLayer-&gt;getResult(0);</SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; $numResults = 
    $oLayer-&gt;getNumResults();</SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; $shape = 
    $oLayer-&gt;getShape($result-&gt;shapeindex,$result-&gt;tileindex);</SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; echo(var2json($shape));</SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; </SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; This results in the follwing json code 
    to be returned:</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">&gt; 
    </SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">&gt; |{"_handle_":Resource 
    id #45,"numlines":1,"type":0,"index":-1,</SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; </SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; 
    "tileindex":-1,"classindex":0,"numvalues":8,"text":"",</SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; </SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; "bounds":{"_handle_":Resource id 
    #46,"minx":607000,</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">&gt; 
    </SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">&gt; 
    "miny":677000,"maxx":607000,"maxy":677000},</SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; </SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; 
    "values":[null,null,null,null,null,null,null,null]}|</SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; </SPAN><BR><SPAN 
    style="COLOR: rgb(102,102,102)">&gt; No matter what I try, it keeps 
    returning empty shapes. How can this be?</SPAN><BR><BR>Tom,<BR><BR>I agree 
    with Alexander that you should be carefully reviewing your<BR>input 
    coordinate and insuring it is in the same coordinate system<BR>as the raster 
    file. The returned values are expected if you are<BR>attempting to fetch a 
    non-existant result shape.<BR><BR>If you simplify your test case down as 
    much as you can and you still<BR>can't figure out why you do not get a 
    result then you could try to<BR>bundle this up and submit it as a ticket. 
    Keep in mind that such a<BR>ticket is much more likely to be acted on if you 
    make it *easy* for<BR>the developer to reproduce your problem.<BR><BR>Best 
    regards,<BR>-- 
    <BR>---------------------------------------+--------------------------------------<BR>I 
    set the clouds in motion - turn up | Frank Warmerdam, <A 
    href="javascript:top.opencompose('warmerdam@pobox.com','','','')">warmerdam@pobox.com</A><BR>light 
    and sound - activate the windows | <A 
    href="parse.php?redirect=http%3A%2F%2Fpobox.com%2F%7Ewarmerdam" 
    target=_blank><SPAN 
    style="COLOR: red">http://pobox.com/~warmerdam</SPAN></A><BR>and watch the 
    world go round - Rush | Geospatial Programmer for 
Rent<BR><BR><BR></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>