<HTML>
Hi Jukka,<br>
<br>
Hmmm that does look strange, but as it turns out, removing "LAYER" didn't help.<br>
<br>
Thx anyway ;)<br>
<br>
Tom<br>
<br>
<br>
<br>
<span style="font-weight: bold;">On Wed 02/06/10 13:23 , "Rahkonen Jukka" Jukka.Rahkonen@mmmtike.fi sent:<br>
</span><blockquote style="border-left: 2px solid rgb(245, 245, 245); margin-left: 5px; margin-right: 0px; padding-left: 5px; padding-right: 0px;">
<defanged_meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>BODY {
FONT-SIZE: 12px; FONT-FAMILY: Arial, Helvetica, sans-serif
}
</style>
<defanged_meta content="MSHTML 6.00.2900.5945" name="GENERATOR"><defanged_body>
<div dir="ltr" align="left"><span style="font-size: 10pt; color: rgb(0, 0, 255);" class="117442011-02062010">Hi,</span></div>
<div dir="ltr" align="left"><span style="font-size: 10pt; color: rgb(0, 0, 255);" class="117442011-02062010"></span> </div>
<div dir="ltr" align="left"><span style="font-size: 10pt; color: rgb(0, 0, 0);" class="117442011-02062010">LAYER TEMPLATE
"dummy.html"?</span></div>
<div dir="ltr" align="left"><span style="font-size: 10pt; color: rgb(0, 0, 0);" class="117442011-02062010"></span> </div>
<div dir="ltr" align="left"><span style="font-size: 10pt; color: rgb(0, 0, 0);" class="117442011-02062010">Does such a thing exist? Have you tried with
plain</span></div>
<div dir="ltr" align="left"><span style="font-size: 10pt; color: rgb(0, 0, 0);" class="117442011-02062010"> TEMPLATE "dummy.html"?</span></div>
<div dir="ltr" align="left"><span style="font-size: 10pt; color: rgb(0, 0, 0);" class="117442011-02062010"></span> </div>
<div dir="ltr" align="left"><span style="font-size: 10pt; color: rgb(0, 0, 0);" class="117442011-02062010">-Jukka Rahkonen-</span></div>
<div><span style="font-size: 10pt; color: rgb(0, 0, 255);" class="117442011-02062010"><span style="color: rgb(0, 0, 0);"></span> </span></div>
<div dir="ltr" align="left"><span style="font-size: 10pt; color: rgb(0, 0, 255);"><br>
</span></div><span style="font-size: 10pt; color: rgb(0, 0, 255);"></span><br>
<blockquote dir="ltr" style="padding-left: 5px; margin-left: 5px; border-left: 2px solid rgb(0, 0, 255); margin-right: 0px;">
<div class="OutlookMessageHeader" dir="ltr" align="left" lang="fi">
<hr tabindex="-1">
<span style="font-family: Tahoma; font-size: 10pt;"><span style="font-weight: bold;">Lähettäjä:</span>
mapserver-users-bounces@lists.osgeo.org
[mailto:mapserver-users-bounces@lists.osgeo.org] <span style="font-weight: bold;">Puolesta </span>Tom van der
Putte<br>
<span style="font-weight: bold;">Lähetetty:</span> 2. kesäkuuta 2010 13:34<br>
<span style="font-weight: bold;">Vastaanottaja:</span>
Frank Warmerdam; Alexander Petkov<br>
<span style="font-weight: bold;">Kopio:</span>
mapserver-users@lists.osgeo.org<br>
<span style="font-weight: bold;">Aihe:</span> Re: Re: [mapserver-users]
Mapscript Rasterquery returns empty result<br>
</span><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>
<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>
<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>
<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>
<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: 2px solid rgb(245, 245, 245); 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 ?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></defanged_body></defanged_meta></defanged_meta></blockquote></HTML>