[mapserver-users] Querying a dynamic layer

Jonathon Coombes jon at cybersite.com.au
Thu Sep 19 19:19:02 PDT 2002


On Fri, 2002-09-20 at 11:06, woodbri at swoodbridge.com wrote:
> Jonathan,
> 
> You need to read the gmap75 code a little closer. I think you will 
> find that the query code does not use the rendering code. What this 
> means to you is that just as you have to create the dynamic data 
> layer for the rendering code you need to ALSO add a similar block to 
> create the dynamic data layer in the appropriate place for the query 
> code to pick it up. It has been a while since I looked at that code, 
> but I'm pretty sure that it has 2 different paths for query and 
> render.

Hi Stephen,

Thanks for the reply, and I am glad such an experienced user of
mapserver can help me out.

In regards to your comments however, I am a little confused. Is not
the information returned by the query based on the DATA definition
and METADATA? If you are referring to code to recognise the query,
then I have used the gmap code exactly as is, but with an extra
function built in. The only place I can find close to filling the
query code section you mention is as follows:

/* ---------------------------------------------------------- */
/* Query selected layers at point location or in a rectangle. */
/* DumpQueryResults() will be called later to display the     */
/* results.                                                   */
/* ---------------------------------------------------------- */
   if ($bRectangleInput) {
      $oGeorefRect = ms_newrectobj();
      $oGeorefRect->set("minx", GMapPix2Geo($oPixelRect->minx, 0,
                         $dfWidthPix, $dfMinX, $dfMaxX, 0));
      $oGeorefRect->set("maxx", GMapPix2Geo($oPixelRect->maxx, 0,
                         $dfWidthPix, $dfMinX,$dfMaxX, 0));
      $oGeorefRect->set("miny", GMapPix2Geo($oPixelRect->miny, 0,
                         $dfHeightPix, $dfMinY,$dfMaxY, 1));
      $oGeorefRect->set("maxy", GMapPix2Geo($oPixelRect->maxy, 0,
                         $dfHeightPix, $dfMinY,$dfMaxY, 1));
      // Use '@' to avoid warning if query found nothing
      @$gpoMap->queryByRect($oGeorefRect);

      $gbShowQueryResults = TRUE;
   }

With a similar section for queryByPoint as well.

It appears as though no matter what approach I take, the queryByRect
(or Point), does not return any results? What function or structure
must I create to add the information for the query to find the points?

Regards,
Jonathon




More information about the MapServer-users mailing list