MapScript C# QueryByPoint
Christopher Condit
condit at SDSC.EDU
Mon Mar 6 22:02:34 PST 2006
Actually after further testing it looks as though this only happens with
my raster layers. My vector layers all query just fine.
Is there anything else I need to do for a raster layer (ArcInfo
Coverage) to allow queries to work? I've got the template defined in
the map file.
Thanks,
Chris
________________________________
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Christopher Condit
Sent: Monday, March 06, 2006 1:48 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] MapScript C# QueryByPoint
I have a question about QueryByPoint in C# MapScript. I've subclassed
the layerObj and want to run QueryByPoint from this object.
getNumResults always returns 0, however. I have a template defined for
the layer - and results are returned from the mapserver CGI.
Is there some special way to run a query from inside a layerObj (or
subclass)?
Thanks,
Chris
public class elevationLayer : layerObj
{
public elevationLayer(mapObj map) : base(map)
{
name = "Elevation";
type = MS_LAYER_TYPE.MS_LAYER_RASTER;
data = @"..\elevation\elevation.adf";
}
public string QueryLayer(double x, double y)
{
string ret = null;
int res = queryByPoint(map, new pointObj(x, y, 0, 0),
mapscript.MS_SINGLE, 0.25 );
ret = "<b>Depth: </b>";
if (0 == getNumResults())
ret += "Unknown";
else
{
open();
resultCacheMemberObj result = getResult(0);
if (null != result)
{
shapeObj shape = getFeature(result.shapeindex,
result.tileindex);
ret += int.Parse(shape.getValue(2)) * -1 + "
m.<br />";
}
close();
}
return ret;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060306/183c8884/attachment.htm>
More information about the MapServer-users
mailing list