[Cartoweb-users] RE: customize query tool and new tool in general
Oliver Christen
oliver.christen at camptocamp.com
Wed Nov 28 02:08:00 EST 2007
Hi
why dont you set displayExtendedSelection=true and customize the template to display a dropdown menu instead of a list of checkbox ?
that way you should be able to query only one layer using the existing query tool
regards
Oliver
----- Original Message -----
From: karsten vennemann
To: cartoweb-users at lists.maptools.org
Sent: Wednesday, November 28, 2007 7:33 AM
Subject: [Cartoweb-users] RE: customize query tool and new tool in general
I got only a tiny bit further towards my goal over the last several days regarding my first message below.
Regarding 2.) below
I modified the tpl template and was able to reformat and place the query results for a layer elsewhere on the page. I still could not really figure out how to approach creating/or modifying a query tool to return the attributes for just one selected layer and not all that are selected in the themes tab.
From the documentation in Chapter 2.4.2.3 it seems that I just can use these parameters for a query:
Query plugin
o query_layer - layer to look for IDs
o query_select - IDs of objects to add to selection
o query_unselect - IDs of objects to remove from selection
o query_policy - selection policy: 'POLICY_XOR', 'POLICY_UNION' or
'POLICY_INTERSECTION', default is 'POLICY_XOR'
o query_maskmode - '0' or '1', default is '0'. If '1', will show selection as a mask.
o query_hilight - '0' or '1', default is '1'. If '0', won't shows selection hilighted.
o query_return_attributes - '0' or '1', default is '1'. If '0', won't return
attributes other than IDs.
o query_return_table - '0' or '1', default is '1'. If '0', won't return any table
results.
o query_clear - '0' or '1', default is '0'. If '1',
How can I make a new tool and trigger such a query. Do I need to create a modified/new plugin?
For example if I had a list of layers (in a dropdown box) all that I wanted to be able to run a query on. How would I trigger a query on the selected layer from a new tool button? I guess javascript calling php, but how would I get the button from the new plugin to show up in the template .
By the way - Is there a way to retrieve all layers that have "id_attribute_string" and
"query_returned_attributes". defined somehow?
Karsten
------------------------------------------------------------------------------
From: karsten vennemann [mailto:karsten at terragis.net]
Sent: Friday, November 23, 2007 00:10
To: 'cartoweb-users at lists.maptools.org'
Subject: customize query tool and new tool in general
Hi all,
I'm working on customizing the tools for my cartoweb3.4 project. I started off with the CartoWeb3 Demo and added my data and metadata for the layers I wanted to enable queries for. However, with this projects template/set-up the queries always seem to run onto all layers - no matter whether I check the "query all layers" checkbox. Thus I usually get an error since some of my layers (which I didn't configure with metadata and didn't intend to use for queries) don't have values for
"id_attribute_string" and
"query_returned_attributes".
My goal is to have a dropdown list of all queriable layers and the user can select the layer she wants to query, then click on the map to query by point. Only the attributes of the user selected layer should be returned and displayed.
My questions are
1. How and where would I start doing this modification. At this point I'm not sure whether that functionality is readily available or need some customization of the query/and table plugin? And as well as for the smarty template to change the location where the results are displayed?.
2. How would I include a new tool in the template - I guess that would be a javascript calling a php function? Is there a place where the other tools and their js code is located?
3. I found the example below in the documentation ( 2.4.2.3. Example)- copied below. This seems like a class I could modify to suit my need and send a request from a new tool to ?
Cheers
Karsten
The following class implements a filter which allows to recenter on an object while hilighting it:
class ClientFilterIdrecenter extends ClientPlugin implements FilterProvider { public function filterPostRequest(FilterRequestModifier $request) {} public function filterGetRequest(FilterRequestModifier $request) { $id = $request->getValue('id'); if (!is_null($id)) { $layer = 'grid_classhilight'; $request->setValue('query_layer', $layer); $request->setValue('query_maskmode', '1'); $request->setValue('query_select', $id); $request->setValue('id_recenter_layer', $layer); $request->setValue('id_recenter_ids', $id); } }}
Karsten
------------------------------------------------------------------------------
_______________________________________________
Cartoweb-users mailing list
Cartoweb-users at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/cartoweb-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20071128/c9411d5a/attachment.html
More information about the Cartoweb-users
mailing list