MapScript C# QueryByPoint

Christopher Condit condit at SDSC.EDU
Mon Mar 6 16:48:13 EST 2006


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/46775b83/attachment.html


More information about the mapserver-users mailing list