[mapserver-users] displaying query problem
Pushkar Pradhan
pushkar at ERC.MsState.Edu
Sun Apr 7 19:41:49 PDT 2002
Steven,
Thank you for your response but it didn't work either.
Just to make sure "RESULT_FIELDS" must contain the attribs. name, right?
In doing a query do I need any other function besides
gMapDumpQueryResults() in order to display the info. about the layers?
> Pushkar,
>
> You MUST also have a TEMPLATE statement in the LAYER or CLASS definition
> or that layer will NOT be queried. It is sufficent to say
>
> TEMPLATE void
>
> -Steve
>
> Pushkar Pradhan wrote:
> >
> > Hi,
> > I am trying to display query results, I am using code from the gmap demo.
> > In short I do this, the gmapDumQueryResults() is unchanged from gmap demo.
> > In my map file I have:
> > METADATA
> > "DESCRIPTION" "Buildings"
> > "RESULT_FIELDS" "Area Perimeter"
> > END
> > Area and perimeter are the attribs I want displayed.
> > When I query a point in my map I get:
> > Nothing found at query location. even though I click on a layer.
> > This happens because the numResults val. in gmapDumpQueryResults() is
> > zero:
> > $numResults = $oLayer->getNumResults();
> >
> > if ($numResults == 0)
> > continue; // No results in this layer
> >
> > php code:
> > if ( isset($HTTP_POST_VARS["mode"]) ) {
> > $nClickPixX = intval($HTTP_FORM_VARS[mapa_x]);
> > $nClickPixY = intval($HTTP_FORM_VARS[mapa_y]);
> > $dfWidthPix = 600;
> > $dfHeightPix = 500;
> > $dfMinX = $map->extent->minx;
> > $dfMaxX = $map->extent->maxx;
> > $dfMinY = $map->extent->miny;
> > $dfMaxY = $map->extent->maxy;
> > if( $HTTP_POST_VARS["mode"] == "query") {
> > $nClickGeoX = GMapPix2Geo($nClickPixX, 0, $dfWidthPix, $dfMinX,
> > $dfMaxX, 0);
> > $nClickGeoY = GMapPix2Geo($nClickPixY, 0, $dfHeightPix, $dfMinY,
> > $dfMaxY, 1);
> >
> > $oClickGeo = ms_newPointObj();
> > $oClickGeo->setXY($nClickGeoX, $nClickGeoY);
> >
> > // Use '@' to avoid warning if query found nothing
> > @$map->queryByPoint($oClickGeo, MS_SINGLE, -1);
> > gmapDumpQueryResults();
> > }
> > } // end of if loop
> > Do I need to call some other functions.
> > ------------------------------------------------------------------------------
> > PUSHKAR S. PRADHAN
> > Research Assistant
> > MISSISSIPPI STATE UNIVERSITY,
> > STARKVILLE, MS 39759.
> >
> > Engineering Research Center
> > Box 9627
> > Mississippi State, MS 39762-9627
> > ------------------------------------------------------------------------------
>
------------------------------------------------------------------------------
PUSHKAR S. PRADHAN
Research Assistant
MISSISSIPPI STATE UNIVERSITY,
STARKVILLE, MS 39759.
Engineering Research Center
Box 9627
Mississippi State, MS 39762-9627
------------------------------------------------------------------------------
More information about the MapServer-users
mailing list