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

Mike Leahy mgleahy at alumni.uwaterloo.ca
Tue Jul 29 18:23:53 PDT 2008


Steve,

Thanks for the reply.  To clarify, I am using 5.2.  I'm guessing by what 
you're saying is that bugs with a new feature like this are to be 
expected - I just wanted to check if it was already known to anyone else 
before submitting a ticket in the trac.

Regards,
Mike

Steve Lime wrote:
> Support for tile names relative to the tile index is brand new in 5.2 so in older versions
> absolute paths or paths relative to the mapfile were your only options.
> 
> Steve
> 
>>>> On 7/29/2008 at 12:44 PM, in message <488F56FC.9070701 at alumni.uwaterloo.ca>,
> Mike Leahy <mgleahy at alumni.uwaterloo.ca> wrote:
>> 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
>>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org 
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
> 



More information about the MapServer-users mailing list