Opened 14 years ago

Closed 14 years ago

#3166 closed defect (fixed)

raster query support broken

Reported by: warmerdam Owned by: sdlime
Priority: normal Milestone: 5.6 release
Component: MapServer C Library Version: svn-trunk (development)
Severity: normal Keywords: raster query getfeatureinfo
Cc: tomkralidis

Description

Steve,

The command:

mapserv QUERY_STRING="map=tomk_workshop.map&version=1.1.1&service=WMS&request=GetFeatureInfo&srs=EPSG:4326&bbox=-180,-90,180,90&format=image/png&layers=land_shallow_topo_2048,rivers&styles=,&transparent=true&width=500&height=300&query_layers=land_shallow_topo_2048&info_format=text/html&x=141&y=91&radius=10

run within the msautotest/wxs directory produces a result including:

			<tr>
				<td>1</td>
				<td>[red]</td>
				<td>[green]</td>
				<td>[blue]</td>
			</tr>

Stepping through the code the problem appears to be that the mapserv->resultshape is not being filled with attribute items when msRASTERLayerGetShape() is called. This is because this function depends on layer->numitems/layer->items[] which is populated by msRASTERLayerGetItems() but in this query scenario that function is never called.

This used to work in 5.4, and I'm presuming the failure now is somehow related to the one pass query implementation, though I'm not sure of that.

Can you comment on why GetItems is never called? Shouldn't it be?

Change History (2)

comment:1 by sdlime, 14 years ago

Status: newassigned

I'm sure this is one-pass related. The one-pass processing has msLayerGetItems() is called as part of msLayerWhichItems() for most data sources but all the query code bails for rasters. I guess ideally the raster query code should incorporate the same structural changes as the vector stuff. That is,

  • open the layer (if queryable)
  • get all items through msLayerWhichItems() or equivalent
  • but DON'T close the layer since it will be acted on via templates or drawing later

This should leave the items/numitems stuff intact. The one-pass processing makes sure we have enough information so that we only need to go back to the result set thus avoiding the very expensive msLayerGetShape() calls.

I can work on this given the test case you've identified. My guess is that the changes are not huge.

Also, since the raster query functions are wrapped by the main query functions they don't use a queryObj but that shouldn't be an issue in this case.

Steve

comment:2 by sdlime, 14 years ago

Resolution: fixed
Status: assignedclosed

My fix (in r9456) was simply to call msRASTERLayerGetItems() once a successful query was done in msRasterQueryByRect(), right at the bottom. This properly populates the items/numitems variables. Tom's test case works with that change. The other raster query functions all call msRasterQueryByRect() so I didn't muck with those.

Closing for now. Please let me know if you have concerns with that change...

Steve

Note: See TracTickets for help on using tickets.