[mapserver-users] Mapscript Rasterquery returns empty result

Frank Warmerdam warmerdam at pobox.com
Thu Apr 29 10:07:04 EDT 2010


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