[Chameleon] Locate by Attribute Widget

Delfos, Jacob Jacob.Delfos at maunsell.com
Wed Mar 21 17:44:49 EST 2007


Hi Jessica,
 
Answers inline


________________________________

	From: chameleon-bounces at lists.maptools.org
[mailto:chameleon-bounces at lists.maptools.org] On Behalf Of Jessica
Fendos
	Sent: 22 March 2007 06:47
	To: chameleon at lists.maptools.org
	Subject: [Chameleon] Locate by Attribute Widget
	
	
	Hi list:
	 
	I am a newbie to Chameleon and am trying to build an interactive
mapping website for a State of MN project. In my application, I would
like to have a query function that will enable the users to search for
developable sites that meet a certain criteria (e.g. size between 2-4
acres, building type is industrial, and location in X city, Y county.) I
tried using the LocateByAttribute widget. According to the
how_to_use.txt, you can set it up for an iframe or a pop up. I tried
embedding both in my html file:
	 
	<cwc2 type="LocateByAttribute" searchall="true"
pointzoombuffer="500" height="90" width="400" highlight="true"
allowdownload="true" popup="false" VISIBLE="TRUE"/>
	 
	<cwc2 type="LocateByAttribute" searchall="true"
pointzoombuffer="500" height="90" width="400" highlight="true"
allowdownload="true" popup="true" linktext="Locate By Atts"
VISIBLE="TRUE"/>
	 
	Mapfile (just one layer for this example)
	 
	LAYER # LRT
	  NAME "Hiawatha LRT"
	  METADATA
	    "Transportation" "true"
	    "RESULT_FIELDS" "line_id from_stat to_stat"
	    "SPATIALSEARCH" "FROM_STAT"
	    "SPATIALSEARCHLIST" "DETAILS"
	  END
	  GROUP "Hiawatha LRT"
	  STATUS OFF
	  MAXSCALE 200000
	  DATA LRT
	  TYPE LINE
	  CLASS NAME "Hiawatha LRT" TEMPLATE "ttt_query.html" STYLE SIZE
3 COLOR 255 153 51 SYMBOL "circle" END END
	  TOLERANCE 5
	 
	My questions are as follows:
	 
	1. Since my application requires multiple query (size, type,
location), how can the widget be customized to fit this need? 
	 

Well..... it would have to be rebuilt from the ground up, pretty much.
It would require a mechanism that keeps adding criteria-boxes
dynamically, and that manages the dynamic number of form fields, also on
the server-side. It could probably be done, but would be quite complex.

	 
	2. Also, I could not make a nice looking icon to display using
the tag below. Could someone please pinpoint what I did wrong? 
	 
	<cwc2 type="LocateByAttribute" styleresource="TextButtons"
imagewidth="150" Image="icons/icon_locate.png" ImageTip="Locate"
Label="Locate" searchall="false" popup="true" height="500" width="500"
highlight="true" allowdownload="true"  visible="true">
	        <image state="normal"/>
	        <image state="selected"/>
	        <image state="hover"/>
	</cwc2>
	 

The LocateByAttribute widget is not integrated with the buttuonizer or
the styleresource widget yet. So basically that syntax won't work. To
use an image as a link, you could try something like 
 
<cwc2 type="LocateByAttribute" searchall="true" pointzoombuffer="500"
height="90" width="400" highlight="true" allowdownload="true" popup="
true "  linktext="<img src='/image.gif'&#62"  VISIBLE="TRUE"/> 
 
Not pretty, but will sort of do the job. Watch the funny syntax at
"linktext". Obviously I have to fix this up properly some time.

	3. The result of my search interface (from popup), has a list of
objects that meet my search query. They look like they are hyperlinks
but they are not. I tried adding LINK field in my shapefile and added
LINK in the RESULT_FIELD in metadata description but got an error
message: undefined index: LINK in
D:\Sites\....\chameleon-2.2.1\htdocs\widgets\LocateByAttribute\searchres
ults.phtml on line 724. How can I have my search results link to other
URLs? I also altered the searchstring size in the searchresult.phtml
from 10 to 40 but it seemed to have no effect.  
	 

They are hyperlinks, you're not dreaming :) If you click on them, it
will zoom to the object. If it doesn't zoom, something is wrong. Maybe
you did not specify the CWCJSAPI widget properly (it can work without
the widget, but will return results in a popup so they are not lost when
the page is submitted for a zoom). If it doesn't zoom, there *should* be
javascript errors. Please use the "Error Console" in Firefox to check.
I'm not sure what "RESULT_FIELD" is, but it won't be related to the
widget. If you want to link to other URLs, put a URL in one of the
attribute fields (use HTML syntax, e.g. <a href='blah' .....>), and it
should show up in the result, providing the attribute name you put it in
is included in the "spatialsearchlist" metadata element.

	 
	4. Using the same map file.  Iframe and popup rendered different
search options. Iframe was defaulted to object ID and map, while popup
will display options as you specified in your mapfile metadata
(spatialsearch). Why is that? 

They *should* behave the same. Make sure you have "searchall='false'" in
the definition.
Please let me know whether any issues persist.
 
best regards,
 
Jacob
 


This email and any attachments are intended solely for the named recipient and are confidential. The copying or distribution of them or any information they contain by anyone other than the named recipient is prohibited. If you have received this document in error, please notify the sender and delete all copies from your computer system and destroy all hard copies. It is the recipient's responsibility to check this email and any attachments to this email for viruses before use.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20070322/3abe2e3e/attachment-0001.html


More information about the Chameleon mailing list