<!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> </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> </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> TEMPLATE "dummy.html"?</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#000000 size=2><SPAN
class=117442011-02062010></SPAN></FONT> </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> </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
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 <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> EXTENT -1000000 -1200000 2902206
1773859<BR> IMAGETYPE PNG24<BR> SIZE 600
600<BR> STATUS ON<BR> UNITS
METERS<BR> NAME "Test_Map"<BR><BR>
PROJECTION<BR>
'proj=lcc'<BR>
'lat_1=52.67000000000002'<BR>
'lat_2=54.33'<BR>
'lat_0=48'<BR>
'lon_0=10'<BR>
'x_0=815000'<BR>
'y_0=0'<BR>
'ellps=intl'<BR>
'units=m'<BR>
'no_defs'<BR> END<BR><BR>*** For the test
LAYER:<BR><BR> LAYER<BR> NAME
"mask"<BR> DATA
"c:/ms4w/Apache/htdocs/data/rasters/depthmaps/tert_msk_rast.img"<BR>
TYPE RASTER<BR> STATUS ON<BR>
LAYER TEMPLATE "dummy.html"<BR>
CLASS<BR> NAME
"1"<BR> EXPRESSION ([pixel] ==
1)<BR> STYLE<BR>
color 255 0 0
<BR> END
<BR> END<BR>
CLASS<BR> NAME
"2"<BR> EXPRESSION ([pixel] ==
2)<BR> STYLE<BR>
color 0 255 0
<BR> END
<BR> END<BR>
END#layer<BR><BR>*** For the querying script I use this:<BR><BR>$szLayer =
"mask"; <BR>$oLayer = $oMap->getLayerByName($szLayer); //get
Layer<BR>$oMap->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->setXY($x,$y);<BR><BR>$status =
$oLayer->queryByPoint($oPoint, MS_MULTIPLE, 1); //Query<BR>$status =
$oLayer->open();<BR>$result = $oLayer->getResult(0); //Get
Result<BR>$numResults = $oLayer->getNumResults();<BR><BR>$shape =
$oLayer->getShape($result->shapeindex,$result->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)">>
Hi,</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">> </SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> I have the following
code:</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">> </SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">>
$oMap->prepareQuery();</SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> $oPoint =
ms_newPointObj();</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">>
$oPoint->setXY($x,$y); //coords received from a AJAX call</SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> </SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> </SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> $oLayer =
$oMap->GetLayerByName($szLayer); //Name received from a AJAX
call</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">> $status =
$oLayer->queryByPoint($oPoint, MS_MULTIPLE, 1);</SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> $status =
$oLayer->open();</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">>
$result = $oLayer->getResult(0);</SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> $numResults =
$oLayer->getNumResults();</SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> $shape =
$oLayer->getShape($result->shapeindex,$result->tileindex);</SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> echo(var2json($shape));</SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> </SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> This results in the follwing json code
to be returned:</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">>
</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">> |{"_handle_":Resource
id #45,"numlines":1,"type":0,"index":-1,</SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> </SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">>
"tileindex":-1,"classindex":0,"numvalues":8,"text":"",</SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> </SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> "bounds":{"_handle_":Resource id
#46,"minx":607000,</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">>
</SPAN><BR><SPAN style="COLOR: rgb(102,102,102)">>
"miny":677000,"maxx":607000,"maxy":677000},</SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> </SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">>
"values":[null,null,null,null,null,null,null,null]}|</SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> </SPAN><BR><SPAN
style="COLOR: rgb(102,102,102)">> 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>