Opened 20 years ago

Closed 19 years ago

Last modified 19 years ago

#690 closed defect (fixed)

[MapServer]Map queryByPoint() doesn't return information for raster

Reported by: nsavard@… Owned by: warmerdam
Priority: high Milestone: 4.4 release
Component: GDAL Support Version: 4.3
Severity: normal Keywords:
Cc:

Description

The "queryByPoint()" in a map object does not return information for a raster
layer compared to "queryByPoint" in a layer object which returns valid result. 

Fedora Core 1

Change History (7)

comment:1 by dmorissette, 20 years ago

Cc: morissette@… added
Milestone: 4.4 release
The $map->queryByPoint() function in MapScript (and possibly in the mapserv CGI
but I didn't check) calls msQueryByPoint(self, -1, mode, *point, buffer), that
is with a qlayer index of -1.

The following construct seems to have been added to msQueryByPoint() to handle
raster layer queries:

  if( qlayer >= 0 && qlayer < map->numlayers 
      && map->layers[qlayer].type == MS_LAYER_RASTER )
  {
      return msRasterQueryByPoint( map, map->layers+qlayer, mode, p, buffer );
  }


This doesn't take into account the case of qlayer = -1, so the raster layers end
up in the default loop which calls msIsLayerQueryable() and defaults to
reporting raster layers as non-queryable.

I'm not sure how you want to fix this, but I think msIsLayerQueryable() should
be updated to properly report if a layer is queryable, and then you may be able
to share the same loop for both vectors and rasters. msIsLayerQueryable() is
used in other places, at least in the WMS GetCapabilities, and possibly in the
WFS but I didn't check.

comment:2 by fwarmerdam, 20 years ago

Resolution: fixed
Status: newclosed
I have updated msIsLayerQuerable() to support raster files. 

I have updated the 3 query entry points (by rect, by point and by shape) to 
support multiple raster layers. 

Updated msautotest test maps to include a dummy query template so that the
query test passes again. 


comment:3 by nsavard@…, 20 years ago

Resolution: fixed
Status: closedreopened
I updated MapServer source 20040228.  I verified and got the same problem.

comment:4 by fwarmerdam, 20 years ago

Status: reopenedassigned
I'm not sure what 20040228 source is; however, I have confirmed that 
queries against a map were still not working due to my botching my last
change.  I have committed an update that should fix it, and modified 
rqtest.py to include one test that operates against the map instead of an
individual layer (rqtest_6()). 

Seems to be working now.  Sorry for the mess-up.

comment:5 by nsavard@…, 20 years ago

I verified with "bath_mapserver.tif" raster that comes with the "gmap" demo and
it works fine with a PHP MapScript and a MapServer template.

In  comment number three I were not clear by writing:  "I updated MapServer
source 20040228".  I meant Mapserver source was updated May 28 th 2004 from CVS.

comment:6 by fwarmerdam, 19 years ago

Resolution: fixed
Status: assignedclosed
I think Normand means that the fix works, so I am closing the bug. 
Please re-open if there is an outstanding issue. 

comment:7 by nsavard@…, 19 years ago

I tested with the layer and map objects "queryByPoint" method again with gmap. 
I modified the "GMap75CheckClick()" function in "gmap75.inc.php" file as shown
below.  I just commented or uncommented the correct function call as needed.

I tested again the "queryByPoint" through CGI interface and it works as expected.


To execute these tests I used MapServer CVS source Nov 11 13:51.

----------------
PHP_Mapscript:
                ...

		else
		{
		    $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
		    echo 'gpoMap';
		    @$gpoMap->queryByPoint($oClickGeo, MS_SINGLE, -1);

                    //echo 'poLayer';
		    //$poLayer = $gpoMap->getlayerbyname('bathymetry');
		    //$poLayer->queryByPoint($oClickGeo, MS_SINGLE, -1);

                    $gbShowQueryResults = TRUE;
		}

                ...
Note: See TracTickets for help on using tickets.