[mapserver-users] Querying a dynamic layer

woodbri at swoodbridge.com woodbri at swoodbridge.com
Fri Sep 20 19:49:53 EDT 2002


Johnathan,

I think I mis-spoke, that is what I get for talking before I look at 
the code <sigh> and I seem to have deleted your orignal post so I am 
not sure what the problem is.

But if you notice in the function GMapDumpQueryResults() there is a 
for loop:

    for($iLayer=0; $iLayer < $gpoMap->numlayers; $iLayer++)
    {
        $oLayer = $gpoMap->GetLayer($iLayer);

Try putting some debug prints here and make sure it is seeing your 
layer. like:
         print "<br>" . $oLayer->name . "\n";

if your layer name shows then you can print more stuff about if to 
see what the problem is. If it does not show, then you need to do 
something to either get it on the list of layers or some how get it 
to be processed through this block of code.

Sorry for the confusion,
  -Steve


On 20 Sep 2002 at 12:19, Jonathon Coombes wrote:

> 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