[Cartoweb-users] Passing variable to mapserver
Oliver Christen
oliver.christen at camptocamp.com
Tue Mar 18 02:55:29 EDT 2008
mapOverlay code goes on SERVER side and is triggered from client side using
the usual client->server variable transfert.
there was also quite a lot of message about this posted on the mailing list
lately
regards
Oliver
> Ok Oliver....
> My clientplugin now extend also ServerCall
> like this:
>
> /**
> * @see ServerCaller::buildRequest()
> */
> public function buildRequest() {
> $layer = new LayerOverlay();
> $layer->name = "mylayer";
> $layer->data = "the_geom from (SELECT *, geocodifica2.the_geom
> FROM servizi, geocodifica2 WHERE servizi.gid = geocodifica2.gid)" .
> "AS foo USING UNIQUE gid USING SRID=4326";
> $layer->filter = "servizio_uno = 'Y'"; }
>
>
> /**
> * @see ServerCaller::initializeResult()
> */
> public function initializeResult($result) {}
>
>
> /**
> * @see ServerCaller::handleResult()
> */
> public function handleResult($result) {}
>
>
>
> and server side something like this: ?
>
> class ServerExampleRecentering extends ClientResponderAdapter {
>
> /**
> * @var Logger
> */
> private $log;
>
> /**
> * @var objet
> */
> private $layer;
>
>
> /**
> * Constructor
> */
> function __construct() {
> parent::__construct();
> $this->log =& LoggerManager::getLogger(__CLASS__);
> }
>
>
> /**
> * @see ClientResponder::initializeRequest()
> */
> function initializeRequest($requ) {
> if ($requ)
> $this->layer = $requ->layer;
> }
>
>
>
> /**
> * Result is set in initializeRequest but Outline must be called
> * in handlePreDrawing
> * @see ClientResponder::handlePreDrawing()
> */
> function handlePreDrawing($requ) {
> if ($requ) {
> $mapOverlay = $this->serverContext->getPluginManager()
> if (empty($pluginManager->mapOverlay))
> throw new CartoserverException("mapOverlay plugin not
> loaded, "
> . "and needed to draw the
> new layer");
> $mapOverlay->updateMap($this->layer);
> }
> }
>
> }
>
>
>
> Oliver Christen ha scritto:
>> you cant do it like that
>> you need to use mapOverlay to set the filter dynamicaly
>>
>> http://www.cartoweb.org/doc/cw3.4/xhtml/dev.mapoverlay.html#dev.mapoverlay.usage.filter
>> (second example)
>>
>> regards
>> Oliver
>>
>>> Hi!
>>> I want to pass variable "myvar" to mapserver taken from
>>> "filterPostRequest(FilterRequestModifier $request)" implemented in my
>>> own cartoweb plugin.
>>>
>>> In the map file LAYER I've written:
>>>
>>>
>>> ....
>>>
>>> CONNECTIONTYPE postgis
>>> CONNECTION "user=******password=*****dbname=indirizzi
>>> host=localhost port=5432"
>>> DATA "the_geom from (SELECT *, geocodifica2.the_geom FROM servizi,
>>> geocodifica2 WHERE servizi.gid = geocodifica2.gid) as foo using unique
>>> gid using SRID=4326"
>>> FILTER "servizio_uno = 'Y' and indirizzo ilike '%'\%myvar%'\ %'"
>>>
>>>
>>> ....
>>>
>>>
>>> How can I do to display my layer correctly?
>>> "ilike" and "%" are my problems....
>>>
>>> Thanks a lot !
>>>
>>> --
>>> Ing. Fabio D'Ovidio
>>>
>>> iQuadro - Informatica e Innovazione s.r.l.
>>> Via C. Pisacane 23, Aversa (CE) - 81031
>>> Web : www.ii2.it
>>> Tel.: 081 197 57 600
>>> mail: fabiodovidio at gmail.com
>>>
>>> _______________________________________________
>>> Cartoweb-users mailing list
>>> Cartoweb-users at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>>
>>
>>
>
> --
> Ing. Fabio D'Ovidio
>
> iQuadro - Informatica e Innovazione s.r.l.
> Via C. Pisacane 23, Aversa (CE) - 81031
> Web : www.ii2.it
> Tel.: 081 197 57 600
> mail: fabiodovidio at gmail.com
>
>
More information about the Cartoweb-users
mailing list