Re: Re: [mapserver-users] Mapscript Rasterquery returns empty result

2010-06-02 Thread Tom van der Putte
Hi
Frank, Alexander,
 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:
 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:
 {_handle_:Resource id
#47,numlines:1,type:0,index:-1,tileindex:-1,classindex:0,numvalues:8,text:,bounds:{_handle_:Resource
 id
#48,minx:401265.0032,miny:633815.31,maxx:401265.0032,maxy:633815.31},values:[null,null,null,null,null,null,null,null]}
 When I click on any nodata area the response is  

Warning: [MapServer Error]: msQueryByPoint(): No matching record(s)
found. in C:ms4wappsfusionMapServerphpGetRasterPoint.php on line 36
 Fatal error: [MapServer Error]: msRASTERLayerGetShape(): Out of
range shape index requested. Requested 0 but only 0 shapes available.
in C:ms4wappsfusionMapServerphpGetRasterPoint.php on line 42
 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.
 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? 
 The TIFF I use for testing is available from:   BODY {
font-family:Arial, Helvetica, sans-serif;font-size:12px;
}http://www.vdputte.nl/test_tiff.rar  *** For the MAP part of the
mapfile, I use the following (I removed most non-essential things):
 EXTENT -100 -120 2902206 1773859
 IMAGETYPE PNG24
 SIZE 600 600
 STATUS ON
 UNITS METERS
 NAME Test_Map
 PROJECTION
 'proj=lcc'
 'lat_1=52.670002'
 'lat_2=54.33'
 'lat_0=48'
 'lon_0=10'
 'x_0=815000'
 'y_0=0'
 'ellps=intl'
 'units=m'
 'no_defs'
 END
 *** For the test LAYER:
 LAYER
   NAME mask
   DATA
c:/ms4w/Apache/htdocs/data/rasters/depthmaps/tert_msk_rast.img
   TYPE RASTER
   STATUS ON
 LAYER TEMPLATE dummy.html
   CLASS
 NAME 1
 EXPRESSION ([pixel] == 1)
 STYLE
 color 255 0 0 
 END
   END
   CLASS
 NAME 2
 EXPRESSION ([pixel] == 2)
 STYLE
 color 0 255 0 
 END
   END
 END#layer
 *** For the querying script I use this:
 $szLayer = mask; 
 $oLayer = $oMap-getLayerByName($szLayer); //get Layer
 $oMap-prepareQuery();
 // To be sure no CRS problems arise, I use these coords, smack in
the middle of the left area
 $x = 360429;
 $y = 642536;
 /* 
 //For NoData, use
 $x = 759753;
 $y = 935658;
 // for a point right between the 2 areas
 */
 $oPoint = ms_newPointObj(); //Create Point
 $oPoint-setXY($x,$y);
 $status = $oLayer-queryByPoint($oPoint, MS_MULTIPLE, 1); //Query
 $status = $oLayer-open();
 $result = $oLayer-getResult(0); //Get Result
 $numResults = $oLayer-getNumResults();
 $shape = $oLayer-getShape($result-shapeindex,$result-tileindex);
// Retrieve shape
 echo(var2json($shape)); //echo to browser
 Can anybody confirm that they get the same behaviour?
 Cheers,
 Tom
 On Thu 29/04/10 16:07 , Frank Warmerdam warmer...@pobox.com sent:
 Tom van der Putte wrote:
  Hi,
  
  I have the following code:
  
  $oMap-prepareQuery();
  $oPoint = ms_newPointObj();
  $oPoint-setXY($x,$y);   //coords received from a AJAX call
  
  
  $oLayer = $oMap-GetLayerByName($szLayer); //Name received from a
AJAX call
  $status = $oLayer-queryByPoint($oPoint, MS_MULTIPLE, 1);
  $status = $oLayer-open();
  $result = $oLayer-getResult(0);
  $numResults = $oLayer-getNumResults();
  $shape =
$oLayer-getShape($result-shapeindex,$result-tileindex);
  echo(var2json($shape));
  
  This results in the follwing json code to be returned:
  
  |{_handle_:Resource id #45,numlines:1,type:0,index:-1,
  
  tileindex:-1,classindex:0,numvalues:8,text:,
  
  bounds:{_handle_:Resource id #46,minx:607000,
  
  miny:677000,maxx:607000,maxy:677000},
  
  values:[null,null,null,null,null,null,null,null]}|
  
  No matter what I try, it keeps returning empty shapes. How can
this be?
 Tom,
 I agree with Alexander that you should be carefully reviewing your
 input coordinate and insuring it is in the same coordinate system
 as the raster file.  The returned values are expected if you are
 attempting to fetch a non-existant result shape.
 If you simplify your test case down as much as you can and you still
 can't figure out why you do not get a result then you could try to
 bundle this up and submit it as a ticket.  Keep in mind that such a
 ticket is much more likely to be acted on if you make it *easy* for
 the developer to reproduce your problem.
 Best regards,
 -- 

---+--
 I set the clouds in motion - turn up   | Frank Warmerdam, 
 light and sound - activate the 

Re: Re: [mapserver-users] Mapscript Rasterquery returns empty result

2010-06-02 Thread Rahkonen Jukka
Hi,
 
LAYER TEMPLATE dummy.html?
 
Does such a thing exist? Have you tried with plain
 TEMPLATE dummy.html?
 
-Jukka Rahkonen-
 





Lähettäjä: mapserver-users-boun...@lists.osgeo.org 
[mailto:mapserver-users-boun...@lists.osgeo.org] Puolesta Tom van der Putte
Lähetetty: 2. kesäkuuta 2010 13:34
Vastaanottaja: Frank Warmerdam; Alexander Petkov
Kopio: mapserver-users@lists.osgeo.org
Aihe: Re: Re: [mapserver-users] Mapscript Rasterquery returns empty 
result


Hi Frank, Alexander,

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:

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:

{_handle_:Resource id 
#47,numlines:1,type:0,index:-1,tileindex:-1,classindex:0,numvalues:8,text:,bounds:{_handle_:Resource
 id 
#48,minx:401265.0032,miny:633815.31,maxx:401265.0032,maxy:633815.31},values:[null,null,null,null,null,null,null,null]}

When I click on any nodata area the response is  
Warning: [MapServer Error]: msQueryByPoint(): No matching record(s) 
found. in C:\ms4w\apps\fusion\MapServer\php\GetRasterPoint.php on line 36

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



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.



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? 



The TIFF I use for testing is available from:  
http://www.vdputte.nl/test_tiff.rar
*** For the MAP part of the mapfile, I use the following (I removed 
most non-essential things):
EXTENT -100 -120 2902206 1773859
IMAGETYPE PNG24
SIZE 600 600
STATUS ON
UNITS METERS
NAME Test_Map

PROJECTION
'proj=lcc'
'lat_1=52.670002'
'lat_2=54.33'
'lat_0=48'
'lon_0=10'
'x_0=815000'
'y_0=0'
'ellps=intl'
'units=m'
'no_defs'
END

*** For the test LAYER:

LAYER
  NAME mask
  DATA 
c:/ms4w/Apache/htdocs/data/rasters/depthmaps/tert_msk_rast.img
  TYPE RASTER
  STATUS ON
LAYER TEMPLATE dummy.html
  CLASS
NAME 1
EXPRESSION ([pixel] == 1)
STYLE
color 255 0 0 
END
  END
  CLASS
NAME 2
EXPRESSION ([pixel] == 2)
STYLE
color 0 255 0 
END
  END
END#layer

*** For the querying script I use this:

$szLayer = mask; 
$oLayer = $oMap-getLayerByName($szLayer); //get Layer
$oMap-prepareQuery();

// To be sure no CRS problems arise, I use these coords, smack in the 
middle of the left area
$x = 360429;
$y = 642536;

/* 
//For NoData, use
$x = 759753;
$y = 935658;
// for a point right between the 2 areas
*/

$oPoint = ms_newPointObj(); //Create Point
$oPoint-setXY($x,$y);

$status = $oLayer-queryByPoint($oPoint, MS_MULTIPLE, 1); //Query
$status = $oLayer-open();
$result = $oLayer-getResult(0); //Get Result
$numResults = $oLayer-getNumResults();

$shape = $oLayer-getShape($result-shapeindex,$result-tileindex); // 
Retrieve shape

echo(var2json($shape)); //echo to browser


Can anybody confirm that they get the same behaviour?

Cheers,
Tom



On Thu 29/04/10 16:07 , Frank Warmerdam warmer...@pobox.com sent:


Tom van der Putte wrote:
 Hi,
 
 I have the following code:
 
 $oMap-prepareQuery();
 $oPoint = ms_newPointObj();
 $oPoint-setXY($x,$y); //coords received from a AJAX call
 
 
 $oLayer

Re: Re: Re: [mapserver-users] Mapscript Rasterquery returns empty result

2010-06-02 Thread Tom van der Putte
 Hi Jukka,
 Hmmm that does look strange, but as it turns out, removing LAYER
didn't help.
 Thx anyway ;)
 Tom
 On Wed 02/06/10 13:23 , Rahkonen Jukka jukka.rahko...@mmmtike.fi
sent:
   BODY { FONT-SIZE: 12px; FONT-FAMILY: Arial, Helvetica, sans-serif
}   Hi,   LAYER TEMPLATE  dummy.html?   Does such a thing exist?
Have you tried with  plain  TEMPLATE dummy.html?   -Jukka Rahkonen- 
 
-
   Lähettäjä:mapserver-users-boun...@lists.osgeo.org   
[mailto:mapserver-users-boun...@lists.osgeo.org] Puolesta Tom van der 
  Putte
 Lähetetty: 2. kesäkuuta 2010 13:34
 Vastaanottaja:Frank Warmerdam; Alexander Petkov
 Kopio:mapserver-users@lists.osgeo.org
 Aihe: Re: Re: [mapserver-users]Mapscript Rasterquery returns
empty result
Hi Frank, Alexander,
 Again thanks for your reply; I've beenabroad for a month and
haven't had time to check it out. However, I've bendoing some work
on it today, and tested the following:
 I made a testtiff, with 2 large areas surrounded by NoData. When
clicking anywhere in anyone of the 2 big areas I get the response:
 {_handle_:Resource id   
#47,numlines:1,type:0,index:-1,tileindex:-1,classindex:0,numvalues:8,text:,bounds:{_handle_:Resource
   id
#48,minx:401265.0032,miny:633815.31,maxx:401265.0032,maxy:633815.31},values:[null,null,null,null,null,null,null,null]}
 WhenI click on any nodata area the response is  

Warning: [MapServer Error]: msQueryByPoint(): No matching record(s)
found. in C:ms4wappsfusionMapServerphpGetRasterPoint.php on line 36
 Fatal error: [MapServer Error]: msRASTERLayerGetShape(): Out of
range shape index requested. Requested 0 but only 0 shapes available.
in C:ms4wappsfusionMapServerphpGetRasterPoint.php on line 42
 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.
 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? 
 The TIFF I use for testing is available from:  BODY { FONT-SIZE:
12px; FONT-FAMILY: Arial, Helvetica, sans-serif }
http://www.vdputte.nl/test_tiff.rar*** For the MAP part of the
mapfile,I use the following (I removed most non-essential   
things):
 EXTENT -100 -120 29022061773859
 IMAGETYPE PNG24
 SIZE 600600
 STATUS ON
 UNITSMETERS
 NAME Test_Map
PROJECTION
'proj=lcc'
'lat_1=52.670002'
'lat_2=54.33'
'lat_0=48'
'lon_0=10'
'x_0=815000'
'y_0=0'
'ellps=intl'
'units=m'
'no_defs'
 END
 *** For the testLAYER:
 LAYER
   NAMEmask
   DATA   
c:/ms4w/Apache/htdocs/data/rasters/depthmaps/tert_msk_rast.img
  TYPE RASTER
   STATUS ON
LAYER TEMPLATE dummy.html
  CLASS
 NAME1
 EXPRESSION ([pixel] ==1)
 STYLE
color 255 0 0
 END   
   END
  CLASS
 NAME2
 EXPRESSION ([pixel] ==2)
 STYLE
color 0 255 0
 END   
   END
END#layer
 *** For the querying script I use this:
 $szLayer =mask; 
 $oLayer = $oMap-getLayerByName($szLayer); //getLayer
 $oMap-prepareQuery();
 // To be sure no CRS problems arise,I use these coords, smack in
the middle of the left area
 $x = 360429;
 $y= 642536;
 /* 
 //For NoData, use
 $x = 759753;
 $y = 935658;
 // for a point rightbetween the 2 areas
 */
 $oPoint = ms_newPointObj();//Create Point
 $oPoint-setXY($x,$y);
 $status =$oLayer-queryByPoint($oPoint, MS_MULTIPLE, 1); //Query
 $status =$oLayer-open();
 $result = $oLayer-getResult(0); //GetResult
 $numResults = $oLayer-getNumResults();
 $shape =   
$oLayer-getShape($result-shapeindex,$result-tileindex); //   
Retrieve shape
 echo(var2json($shape)); //echo to browser
 Cananybody confirm that they get the samebehaviour?
 Cheers,
 Tom
 On Thu 29/04/10 16:07 , Frank Warmerdamwarmer...@pobox.com sent:
Tom  van der Putte wrote:
   Hi,
  
  I have the following  code:
  
   $oMap-prepareQuery();
  $oPoint =  ms_newPointObj();
   $oPoint-setXY($x,$y); //coords received from a AJAX call
  
  
  $oLayer =  $oMap-GetLayerByName($szLayer); //Name received
from a AJAX  call
  $status =  $oLayer-queryByPoint($oPoint, MS_MULTIPLE, 1);
  $status =  $oLayer-open();
   $result = $oLayer-getResult(0);
  $numResults =  $oLayer-getNumResults();
  $shape = 
$oLayer-getShape($result-shapeindex,$result-tileindex);
  echo(var2json($shape));
  
  This results in the follwing json code  to be returned:
   
  |{_handle_:Resource  id
#45,numlines:1,type:0,index:-1,
  
   tileindex:-1,classindex:0

Re: [mapserver-users] Mapscript Rasterquery returns empty result

2010-06-02 Thread Jeff McKenna

Tom van der Putte wrote:
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? 



You could test this yourself with MapServer 5.6.3 quickly by extracting 
MS4W version 3.0 onto a different drive.


-jeff


--
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/




___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


RE: [mapserver-users] Mapscript Rasterquery returns empty result

2010-04-29 Thread Tom van der Putte
Hi Frank, Alexander,

Thx for the replies. I'll give it a try as soon as possible. I do have a good 
hunch however that it won't come down to the coordinates, because when I try 
his on a tiff, this is the error it gives when clicking on a section of the 
tiff that has any value except noData; when I click on an empty section 
(NoData) it gives a different error. Some testing with this showed that it does 
send and uses the correct coords.

I think it might have something to do with the tiffs themselves. I'll follow 
your advise an create a testcase as simple as possible. Note that I'm using 
5.2.1 and can't easily upgrade to 5.6, so a ticket might not be appropriate?

Cheers, Tom
___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


[mapserver-users] Mapscript Rasterquery returns empty result

2010-04-28 Thread Tom van der Putte
Hi,
 I have the following code:
$oMap-prepareQuery();
 $oPoint =  ms_newPointObj();
 $oPoint-setXY($x,$y);   //coords received from a AJAX call
 $oLayer =  $oMap-GetLayerByName($szLayer); //Name received from a
AJAX call
 $status =  $oLayer-queryByPoint($oPoint, MS_MULTIPLE, 1);
 $status =  $oLayer-open();
 $result =  $oLayer-getResult(0);
 $numResults =  $oLayer-getNumResults();
 $shape =  $oLayer-getShape($result-shapeindex,$result-tileindex);
 echo(var2json($shape));

This results in the follwing json code to be returned:

{_handle_:Resource id #45,numlines:1,type:0,index:-1,
 tileindex:-1,classindex:0,numvalues:8,text:,
 bounds:{_handle_:Resource id #46,minx:607000,
 miny:677000,maxx:607000,maxy:677000},
 values:[null,null,null,null,null,null,null,null]}

No matter what I try, it keeps returning empty shapes. How can this
be?

P.S. I'm using mapserver 5.2.1 from the ms4w package.
Cheers,

Tom
  ___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users


Re: [mapserver-users] Mapscript Rasterquery returns empty result

2010-04-28 Thread Alexander Petkov
I'd try and narrow down the area in the code where the issue might be.
More specifically, start working with a pair of coordinates (in the
same CRS as your raster), for which you can look up the raster value
by other means (say, use qgis or write short gdal code). Then, knowing
what the end result should be, narrow it down to where you get issues
in your code.

On Wed, Apr 28, 2010 at 8:48 AM, Tom van der Putte t...@vdputte.nl wrote:
 Hi,

 I have the following code:

 $oMap-prepareQuery();
 $oPoint = ms_newPointObj();
 $oPoint-setXY($x,$y);   //coords received from a AJAX call

 $oLayer = $oMap-GetLayerByName($szLayer); //Name received from a AJAX call
 $status = $oLayer-queryByPoint($oPoint, MS_MULTIPLE, 1);
 $status = $oLayer-open();
 $result = $oLayer-getResult(0);
 $numResults = $oLayer-getNumResults();
 $shape = $oLayer-getShape($result-shapeindex,$result-tileindex);
 echo(var2json($shape));

 This results in the follwing json code to be returned:

 {_handle_:Resource id #45,numlines:1,type:0,index:-1,

 tileindex:-1,classindex:0,numvalues:8,text:,

 bounds:{_handle_:Resource id #46,minx:607000,

 miny:677000,maxx:607000,maxy:677000},

 values:[null,null,null,null,null,null,null,null]}

 No matter what I try, it keeps returning empty shapes. How can this be?

 P.S. I'm using mapserver 5.2.1 from the ms4w package.

 Cheers,

 Tom


 ___
 mapserver-users mailing list
 mapserver-users@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/mapserver-users


___
mapserver-users mailing list
mapserver-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users