MapTools.org

[Chameleon] What does chameleon do?

Julien-Samuel Lacroix lacroix@dmsolutions.ca
Tue, 06 Jan 2004 10:29:14 -0500
Hi,

The Table widget can be what you need. Instead of showing the restairant 
name in the map, where they have a chance to overlap, you put them into 
a table below the map. Look at the documentation 
(http://www.maptools.org/chameleon/wiki/Table). Plus, I'm not sure its 
in the documentation, but the Table widget create a SharedResource 
containing all the element included in it's body. This shared resource 
is called from the named of the one used in the Table and add "_IMAGE" 
at the end. So if your shared resource is called "MyResult", the shared 
resource outputed from the Table will be "MyResult_IMAGE". If you use 
this one in the MapImageSharedResource, you will be sure that your map 
don't show more information than the table show. And in the table you 
will be able to show all the fields you want from the table. However if 
you want to match each record i the table its dot in the map you can use 
number in your table and in your map.

Hope this will help.

Best regards,
Julien

pxniw pxniw wrote:
> Installed new fonts, and that took care of the
> problem. (Thx Julien for suggestion)
> 
> Phew...
> 
> Thanks all for your help.
> 
> Now trying to figure out a way to include all labels.
> (As of right now, it will only list first
> Restaurant_Name in the table)
> 
> Sometimes I might have 10 other times 50 listed.
> Any suggestions for this?
> Thanks
> Px
> 
> --- Julien-Samuel Lacroix <lacroix@dmsolutions.ca>
> wrote:
> 
>>Hi,
>>
>>Sorry I made a mistake here. The label are a little
>>bit problematic in 
>>this particular case. First, If you want the number
>>on your marker 
>>remove completly the label statement. Just
>>specicying Label="" only tell 
>>it to use an empty label. Secondly, since you have
>>more tha one element 
>>in your shared resource, it's a kind of array. So
>>you will have to use 
>>the syntax [$MyResult.0.Restaurant_name],
>>[$MyResult.1....], etc.. I 
>>know it's not very usefull, but the labels were not
>>originally design to 
>>show content of shared resource with more than one
>>row. In future, there 
>>will probably be a keyword like
>>[$MyResult._INDEX_.Restaurant_name] to 
>>use the current record.
>>
>>#2
>>You can only see the content of a shared resource
>>from a widget I think. 
>>Maybe Paul or someone else can confirm that. The
>>Table widget can be 
>>usefull for seeing the content of a shared resource.
>>
>>#3
>>Humm...I don't know. Maybe by putting echo and
>>print_r in the code... ;)
>>Or since yu work with 1.1, you could try using event
>>
>>(http://www.maptools.org/chameleon/wiki/event).
>>
>>Cheers,
>>
>>Julien
>>
>>pxniw pxniw wrote:
>>
>>>Well for some reason I was not on the chameleon
>>
>>list,
>>
>>>so some of my questions did not show up.
>>>
>>>Anyhow, it should be working now.
>>>I got below sample to work, but still had some
>>>problems with Labels. (Labels won't show, and
>>
>>confused
>>
>>>what the correct syntax should be.)
>>>
>>>
>>
> ([$Shared_resource_name.first_element.second_element.etc...])
> 
>>>LABEL="Restaurant name:
>>
>>[$MyResult.Restaurant_name]"/>
>>
>>>But still it won't work.
>>>(Restaurant_name is name of the column in mysql
>>
>>db)
>>
>>>Question #2
>>>
>>>Where do I see the values currently held with
>>>SharedResource? Or is it held in the memory?
>>>
>>>Question #3
>>>
>>>What is good way of debugging when trying things
>>
>>out
>>
>>>with Chameleon?
>>>
>>>Thanks a bunch. Rolling up my sleeves and ready to
>>>roll ;)
>>>
>>>Px
>>>
>>>--- Julien-Samuel Lacroix <lacroix@dmsolutions.ca>
>>>wrote:
>>>
>>>
>>>>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,
>>>>
>>
> === message truncated ===
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes
> http://hotjobs.sweepstakes.yahoo.com/signingbonus
> _______________________________________________
> 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.