MapTools.org

[Chameleon] What does chameleon do?

Julien-Samuel Lacroix lacroix@dmsolutions.ca
Fri, 02 Jan 2004 15:06:02 -0500
Hi,

I fact, he SQLQuery widget can do this, but you should use it in 
combination with the MapImageSharedResource widget 
(http://www.maptools.org/chameleon/wiki/MapImageSharedResource).

The SQLQuery widget take a result from an SQL query and put it in a 
shared resource (http://www.maptools.org/chameleon/wiki/SharedResource). 
A shared resource will be a kind of container for your data here. Then 
you can use the MapImageSharedResource widget to add point in your map. 
Note that your shared resource must contains a latitude and a longitude 
column.

Here's a little example because I know that's a little bit cryptic for 
newbies. Don't hesitate to ask more question if you need and try 
multiple possibility  with these two widget this will help you to 
understand them.

First of all, you should include the SQLQuery widget in your template.

<CWC2 Type="SQLQuery" SharedResourceName="MyResult" SQLQuery="SELECT * 
FROM table WHERE type='restaurant'" Server="localhost" 
Database="MyDatabase"/>

This widget will take all the restaurant from your database and put it 
in the Shared Resource called "MyResult".

Then, where you want your map, you should include the 
MapImageSharedResource widget:

<CWC2 TYPE="MapImageSharedResource" name="main_map" Width="300" 
Height="275" Navigable="false">
   <POINTS NAME="START" SRNAME="MyResult" SRLATCOL="lati" 
SRLONCOL="long" LABEL="Restaurant name: [$GeocodeResult.name]"/>
</CWC2>

This widget will draw a map (300x275 large) that you could not navigate. 
In this map, there will be the points in the MyResult Shared Resource 
(Created by the SQLQuery widget). And this points will be placed in the 
map with the lat/lon defined in the SQL table columns called "lati" and 
"long". Finally, on each point there will be a label "Restaurant name: 
the_name_column_in_your_SQL_table".

If you want to put a Pin marker instead of a red dot, you will need to 
add a MAP parameter in your widget:

<CWC2 TYPE="MapImageSharedResource" name="main_map" Width="300" 
Height="275" Navigable="false">
   <POINTS NAME="REST" SRNAME="MyResult" SRLATCOL="latitude" 
SRLONCOL="longitude" LABEL="Restaurant name: [$GeocodeResult.name]"/>
   <MAP POINT="REST" TYPE="style" PARAM="symbolname" 
VALUE="markers/pin.png"/>
   <MAP POINT="REST" TYPE="style" PARAM="size" VALUE="25"/>
   <MAP POINT="REST" TYPE="label" PARAM="color" VALUE="00FF00"/>
</CWC2>

This will change the symbol used for the symbol markers/pin.png. The 
size will be 25 pixels and the color of the label on it will be green 
(RGB = 00FF00). You could change most (if not all) of the parameters of 
the layer that can be changed with php/mapscript with this widget. For 
other parameters check
http://mapserver.gis.umn.edu/doc40/mapfile-reference.html#layer

Hope this will help.

Cheers,

Julien


Paul Spencer wrote:
> Hi,
> 
> don't have time to respond properly for a few days given the holidays, 
> but I don't think the SQLQuery widget will do what you want, but it 
> should be possible to do it with mapserver and ogr using virtual 
> datasources ... will discuss when I have time.
> 
> Cheers,
> 
> Paul
> 
> pxniw pxniw wrote:
> 
>> Thanks this cleared up things a bit.
>> Basically its copy and Paste type of environment
>> rather than swyg system. Ie if I want to add something
>> for the sample file, I would add "<CWC> some widget
>> here <CWC>" to sample html file.
>>
>> Ok going for more advanced stuff:
>> I noticed that Chameleon will handle MySQL?
>> Found this:
>> http://www.maptools.org/chameleon/wiki/SQLQuery
>>
>> Is this able to do this?
>>
>> I have php and perl scripts working for mapserver with
>> Chameleon and MapLab.
>> I also have some other data in MySQL database.
>> Tables have info like: RestaurantName;City;Lat;Lon
>>
>> How do I query either in PHP or Perl RestaurantName
>> and provide a Pin Label (Marker) for Lat Lon
>> coordinates on my existing mapserver layout for single
>> restaurant?
>>
>> Ie: I have a map of Georgia displayed. User have
>> options to type city in text box (ie Atlanta), and hit
>> Go button.
>>
>> How do I query the MySQL db and show restaurant
>> locations in existing map?
>>
>> Thank You for all of who have provided their time for
>> these projects, I will try to do the same, once I
>> learn things a bit more.
>> Happy Holidays
>>
>>
>> --- Bart van den Eijnden <bartvde@xs4all.nl> wrote:
>>
>>> Hi,
>>>
>>> basically Chameleon is being fed a HTML template
>>> with special tags in it, you can recognize them by "CWC". A zoom-in 
>>> tool for
>>> instance is a widget and is recognized by the CWC in the HTML template.
>>> The basic unit of Chameleon is the widget, the HTML template is a
>>> collection of widgets.
>>>
>>> Chameleon interprets this template and creates HTML
>>> and javascript, which will turn into a full-featured web mapping client.
>>>
>>> Also, it needs to know which map layers to draw,
>>> that's the second configuration element, so always a Mapserver MAP
>>> file which you can create with Maplab if you want (or a Web Map Context
>>> document, but this is harder), is needed.
>>>
>>> In the index.phtml of your sample application both
>>> the HTML template and the MAP file are linked. This is specific for
>>> Chameleon 1.1 and was different in Chameleon 1.0 (which had a service
>>> instance which interpreted templates instead of one application per HTML
>>> template/MAP file combination).
>>>
>>> In short you could say Chameleon is the toolkit to
>>> easily build webmapping clients, which could be configured by someone 
>>> who
>>> knows HTML.
>>>
>>> You can see an example at:
>>>
>>> http://mapsherpa.dmsolutions.ca/hawaii2/
>>>
>>> Hope this helps.
>>>
>>> Best regards,
>>> Bart
>>>
>>> On Tue, 23 Dec 2003 07:33:24 -0800 (PST), pxniw
>>> pxniw <pxniw69@yahoo.com> wrote:
>>>
>>>
>>>> Just downloaded and installed chameleon. (1.1
>>>
>>>
>>> Alpha 6)
>>>
>>>> Its so confusing what is the demo/sample file?
>>>> (I could not find cwc2.php on my files , I think
>>>
>>>
>>> its
>>>
>>>> in the old files) I downloaded files from
>>>>
>>>
>> http://www.maptools.org/chameleon/index.phtml?page=home.html
>>
>>>> and see other site
>>>> http://www.dmsolutions.ca/techserv/chameleon.html
>>>>
>>>> this is getting more confusing.
>>>> Installed
>>>> http://www.maptools.org/dl/chameleon-sample.zip
>>>
>>>
>>> and it
>>>
>>>> works, after few changes in paths.
>>>>
>>>> I tried and understand maplab ok.
>>>>
>>>> How do I use chameleon? Is there a screenshot
>>>> somewhere, so I could see what it is used for? (My
>>>> understanding it has all these widgets, but where,
>>>
>>>
>>> and
>>>
>>>> how do I use them... copy and paste the code? I
>>>
>>>
>>> think
>>>
>>>> I am missing something major here. Im completely
>>>
>>>
>>> nubie
>>>
>>>> so explain with that in mind.
>>>>
>>>> Thanks
>>>>
>>>> __________________________________
>>>> Do you Yahoo!?
>>>> New Yahoo! Photos - easier uploading and sharing.
>>>> http://photos.yahoo.com/
>>>> _______________________________________________
>>>> Chameleon mailing list
>>>> Chameleon@lists.maptools.org
>>>>
>>>
>>> http://lists.maptools.org/mailman/listinfo/chameleon
>>>
>>>
>>>
>>> -- 
>>>  
>>
>>
>>
>>
>> __________________________________
>> Do you Yahoo!?
>> New Yahoo! Photos - easier uploading and sharing.
>> http://photos.yahoo.com/
>> _______________________________________________
>> Chameleon mailing list
>> Chameleon@lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/chameleon
>>
> 

-- 
------------------------------------------------------------
Julien-Samuel Lacroix            lacroix@dmsolutions.ca
DM Solutions Group               http://www.dmsolutions.ca/
------------------------------------------------------------



This archive was generated by Pipermail.