[mapserver-users] Re: mapscript querybypoint on tiled raster layers?

Mike Leahy mgleahy at alumni.uwaterloo.ca
Tue Jul 29 13:44:28 EDT 2008


Ok...I figured out the problem pretty much right after I clicked send on 
that last message.  I had generated my tile index.shp with relative 
paths for the LOCATION field (i.e., relative to the shp file).  I just 
regenerated it with absolute path names, and it the query function works 
fine.

So would this be a known bug of any sort, or is it just bad practice to 
use relative filenames with MapServer?

Regards,
Mike

Mike Leahy wrote:
> Hello list,
> 
> I'm sure this one has come up before, but I can't seem to figure out 
> what I need to do.  I have some tiled raster layers that I've got in a 
> mapfile that is being used for generating ka-map tiles.  I'm trying to 
> query the values on these layer using the queryByPoint function in 
> php_mapscript.  I have a generic identify function that returns results 
> for any of my vector layers, and for non-tiled raster layers - just not 
> for the tiled raster layers.  Is it possible to query tiled raster 
> layers?  If so, can someone spot what I'm doing wrong below?
> 
> The tiled-raster layers in the mapfile generally look like this:
> 
>  LAYER
>   NAME "Tiled Raster"
>   GROUP "Tiled Raster"
>   STATUS ON
>   TYPE RASTER
>   TILEINDEX "/data/index.shp"
>   TILEITEM "LOCATION"
>   METADATA
>    "imageformat" "AGG_JPEG"
>   END
>   PROJECTION
>    "init=epsg:4326"
>   END
>  END
> 
> 
> And here is the function in PHP:
> 
> 
>  public function Identify($oMap,$layer,$x,$y,$cellSize)
>  {
>   $oLayer = $oMap->getLayerByName($layer);
>   if (in_array($oLayer->type,
>    array(MS_LAYER_POINT,MS_LAYER_LINE,MS_LAYER_POLYGON)))
>   {
>    $oLayer->set("toleranceunits",$oMap->units);
>    $oLayer->set("tolerance",$cellSize*3);
>   }
>   else
>   {
>    $oLayer->set("tolerance",0);
>   }
> 
>   $oLayer->set("template","dummy.html");
> 
>   $oQPoint = ms_newPointObj();
>   $oQPoint->setXY($x,$y);
> 
>   $aResults = array();
> 
>   if (@$oLayer->queryByPoint($oQPoint,MS_MULTIPLE,$oLayer->tolerance) == 
> MS_SUCCESS)
>   {
>    $oLayer->open();
>    $nResults = $oLayer->getNumResults();
> 
>    for ($i=0;$i<$nResults;$i++)
>    {
>     $oResult = $oLayer->getResult($i);
>     $oShape = $oLayer->getShape($oResult->tileindex,
>      $oResult->shapeindex);
>     $aResults[] = array($oResult,$oShape);
>    }
>   }
> 
>   return $aResults;
>  }
> 
> 
> Thanks in advance for any help,
> Mike
> 


More information about the mapserver-users mailing list