[mapserver-users] displaying query problem
Stephen Woodbridge
woodbri at swoodbridge.com
Sun Apr 7 16:33:56 PDT 2002
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
> ------------------------------------------------------------------------------
More information about the MapServer-users
mailing list