[Chameleon] Querying a dynamic layer

Paul Spencer pagameba at magma.ca
Thu Sep 23 12:50:27 EDT 2004


Ken,

if you want to see the map file that chameleon is currently using, you 
will need to grab the session id by viewing the source of your page and 
searching for an <input> with name "sid", there should be a number like 
"4152fd8f5f9bf" there.  Chameleon uses this to create a directory called 
sess_<sid> in the session save path (configured in php.ini).  For ms4w 
users, this is /ms4w/tmp/

In the session directory you will find a session file and one or more 
map files.  Open the most recent map file to see what chameleon used on 
the last page load.

You can also see all the variables chameleon holds in the session by 
opening the session file or by including the following at the end of 
your phtml file:

echo "<pre>";
print_r($_SESSION);
echo "</pre>";

be warned that there is a lot in here because of circular references in 
some of the php arrays ...

Cheers,

Paul

Ken-ichi wrote:
> This may be a dumb question, but is there actually a function somewhere 
> to output all the map file variables that Chameleon holds in memory 
> during a session at any given time?
> 
> -Ken-ichi
> 
> Paul Spencer wrote:
> 
>> Ken-ichi ...
>>
>> actually I'm not sure that I have actually seen this done ... anyone 
>> else done this and got it to work?
>>
>> Have you compared the layer definition that is generated by your 
>> script to the one you added to the map file?  Perhaps there is some 
>> subtle difference?
>>
>> Cheers,
>>
>> Paul
>>
>> Ken-ichi wrote:
>>
>>> I Just tried both of these, but still no luck.  I take it others have 
>>> successfully queried dynamically added point layers in the past?
>>>
>>> -Ken-ichi
>>>
>>> Paul Spencer wrote:
>>>
>>>> just a guess, but try giving your template a .html extension and if 
>>>> that doesn't work then try adding a template to the class ...
>>>>
>>>> Ken-ichi wrote:
>>>>
>>>>> Yup, I defined a class.  Looks like this:
>>>>>
>>>>> $clsPoints = ms_newClassObj( $lyrPoints );
>>>>> $clsPoints->label->set( "type", "truetype" );
>>>>> $clsPoints->label->set( "font", "fritqat" );
>>>>> $clsPoints->label->set( "type", "truetype" );
>>>>> $clsPoints->label->set( "size", "6" );
>>>>> $clsPoints->label->set( "position", "CR" );
>>>>> $clsPoints->label->color->setRGB($outlineColor[0],$outlineColor[1],$outlineColor[2]); 
>>>>>
>>>>>                
>>>>> $clsPoints->label->outlinecolor->setRGB(255,244,221);               
>>>>> $styPoints = ms_newStyleObj( $clsPoints );
>>>>> $styPoints->color->setRGB($color[0],$color[1],$color[2]);
>>>>> $styPoints->outlinecolor->setRGB($outlineColor[0],$outlineColor[1],$outlineColor[2]); 
>>>>>
>>>>> $styPoints->set( "symbol", 7 );
>>>>> $styPoints->set( "size", 7 );
>>>>>               So I'm guessing that's not it.
>>>>>
>>>>> -Ken-ichi
>>>>>               Paul Spencer wrote:
>>>>>
>>>>>> Another interesting artefact of mapserver is that you must also 
>>>>>> have a class defined for a layer to be queryable.  Are you also 
>>>>>> creating classes?
>>>>>>
>>>>>> Paul
>>>>>>
>>>>>> Ken-ichi wrote:
>>>>>>
>>>>>>> Hi all.  I'm having trouble using the QueryWidget on a shapefile 
>>>>>>> that I've added to the map dynamically with my own widget.  
>>>>>>> Basically, I set the template property of the layer when I add it 
>>>>>>> to the map, along with the tolerance, but when I click on the 
>>>>>>> points in the layer, the popup lists no results.  Any idea what's 
>>>>>>> happening?  Here's the code for adding the layer, followed by the 
>>>>>>> widget tag I'm using:
>>>>>>>
>>>>>>> $lyrPoints = ms_newLayerObj( $map );
>>>>>>> $lyrPoints->set( "name", $quad[0]." Points" );
>>>>>>> $lyrPoints->set( "type", MS_SHAPE_POINT );
>>>>>>> $lyrPoints->set( "status", MS_ON );
>>>>>>> $lyrPoints->set( "data", "/path/to/data" );
>>>>>>> $lyrPoints->set( "group", "Your Layers");
>>>>>>> $lyrPoints->set( "labelitem", "pointid" );
>>>>>>> $lyrPoints->set( "labelmaxscale", "600000" );
>>>>>>> $lyrPoints->set( "template", "ttt" );
>>>>>>> $lyrPoints->set( "tolerance", 5 );
>>>>>>> $lyrPoints->set( "toleranceunits", "pixels" );
>>>>>>>
>>>>>>>
>>>>>>> <cwc2 type="Query" visible="true" imagetip="Identify Feature" 
>>>>>>> PopupWidth="500" PopupHeight="600" Toolbar="false" Status="false" 
>>>>>>> Menubar="false" RADIUS="20" MAXFEATURES="5" 
>>>>>>> image="icons/icon_query.png" toolset="Navigation" 
>>>>>>> styleresource="NavButtons" popupstyleresource="TextButtons">
>>>>>>>        <image state="normal"/>
>>>>>>>        <image state="hover"/>
>>>>>>>        <image state="selected"/>
>>>>>>> </cwc2>
>>>>>>>
>>>>>>> The query widget seems to work fine when I just include the same 
>>>>>>> layer in the mapfile, so I'm not quite sure what's wrong.
>>>>>>>
>>>>>>> -Ken-ichi
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Chameleon mailing list
>>>>>>> Chameleon at lists.maptools.org
>>>>>>> http://lists.maptools.org/mailman/listinfo/chameleon
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>> _______________________________________________
>>> 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