redraw acc. to query

Daniel Morissette morissette at dmsolutions.on.ca
Tue Oct 31 10:42:30 EST 2000


Dennis Christopher wrote:
> 
> (I posted this question once before, but haven't got an answer.) I don't
> beleive it involves anything difficult.
> Can anyone give me an outline of how to do this?
> 
> I want to have the current map redrawn according to a query result, with
> the areas selected
> by the query drawn in some specified highlight color, and the
> non-selected areas drawn as normal.
> 

Hi Dennis,

Based on what I read in your previous message, I assume that you're
trying to use the QUERYMAP feature with PHP MapScript (i.e. not the
mapserv CGI), right?

In MapScript, if you want selected items to be highlighted according to
the QUERYMAP settings, you have to use the drawQueryMap() method after
running your Query, instead of drawMap().

Say your map contains the following:

QUERYMAP
   COLOR 255 0 0
   STYLE HILITE
END

then you would need the following PHP code to draw your map with the
result of the query highlighted:

    $gpoQueryResults = $gpoMap->QueryUsingPoint(...);

    ...

    if ($gpoQueryResults && $gpoQueryResults->numresults > 0)
    {
        $img = $gpoMap->drawquerymap($gpoQueryResults);
        $url = $img->saveWebImage(0, 0);
    }
    else
    {
        $img = $gpoMap->draw();
        $url = $img->saveWebImage(0, 0);
    }

Unfortunately, drawQueryMap() is not available in the current version
PHP MapScript.  It's one of those functions that we never needed and for
which we had not written a PHP wrapper yet.  Assefa is about to complete
the task of going through all the MapScript classes in the PHP MapScript
module and adding PHP wrappers for the missing ones.  This should be
committed in the CVS in the next few days.

I hope that helps.
-- 
------------------------------------------------------------
 Daniel Morissette             morissette at dmsolutions.on.ca
               http://www.dmsolutions.on.ca/
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.




More information about the mapserver-users mailing list