[Chameleon] Locate layers

Paul Spencer pspencer at dmsolutions.ca
Wed Feb 23 09:21:45 EST 2005


You will need to add some custom code in the main application file (like 
sample_basic.phtml).

The subclass of the Chameleon class that is your application can be 
extended to extract the information you need.  On each page load, you 
can scan the layers in the map file for those that are on with some 
mapscript code like:



class SampleApp extends Chameleon
{
   function SampleApp()
   {
     parent::Chameleon();
     $this->moMapSession = new MapSession_RW;
     $this->moMapSession->setTempDir( getSessionSavePath());
   }
   function CWCDrawPublish()
   {
     for($i=0;$i<$this->moMapObject->oMap->numlayers;$i++)
     {
       $oLayer = $this->moMapObject->oMap->getLayer($i);
       if ($oLayer->status == MS_ON || $oLayer->status == MS_DEFAULT)
       {
         //layer is being requested, do some accounting here ...
         echo "accessing ".$oLayer->name." from ".$oLayer->data;
       }
     }
     echo $this->moUI->DrawPublish();
   }
}


You could also add this loop to drawmap.php instead.

Cheers,

Paul

Vicente Espinosa Garcia wrote:
> 
> 
> Hi
> 
> First thanks for your answer and sorry but my english is terrible.I want 
> to remake my question, I want to make a log of the requested layers for 
> any user. My problem is to get filenames and Kbs of layers used in a 
> request. Is  possible to get this data in chameleon source code?. thanks.
> 
> 
>>
>> Hi,
>>
>> I'm not exactly sure what you are asking.  Chameleon uses MapServer to 
>> draw the map image.  The layers that are part of the map image are 
>> defined in a MAP file that is loaded by MapServer.  In the sample 
>> applications, most use the MAP file 
>> chameleon/samples/map/chameleon.map.  This file directs MapServer to 
>> use the data files from chameleon/samples/data/ and they are mostly 
>> shape files.
>>
>> HTH
>>
>> Paul
>>
>> Vicente Espinosa Garcia wrote:
>>
>>>
>>> Hi I'm a newbie in chameleon software. I'm studying the chameleon 
>>> source code.I want to get the name and the filename of the layers 
>>> that the chameleon load in a request. I have studying the drawmap.php 
>>> but I don't have succes in my search. Please help me. thanks.
>>>
>>>
>>> _______________________________________________
>>> Chameleon mailing list
>>> Chameleon at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/chameleon
>>>
>>
>> -- 
>> +-----------------------------------------------------------------+
>> |Paul Spencer                           pspencer at dmsolutions.ca   |
>> +-----------------------------------------------------------------+
>> |Applications & Software Development                              |
>> |DM Solutions Group Inc                 http://www.dmsolutions.ca/|
>> +-----------------------------------------------------------------+
> 
> 
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon
> 

-- 
+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+


More information about the Chameleon mailing list