mapscript query question

Christopher Condit condit at SDSC.EDU
Thu Jan 19 13:45:25 PST 2006


If I move the call to open the layer, I receive an error that the layer
is not open...

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Jerry Pisk
Sent: Thursday, January 19, 2006 12:13 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-USERS] mapscript query question

Chris,

the layer is already open when you query it, the second opening might
clear out the results. Try to take that call out and move your close
call one block out.

Jerry

On 1/19/06, Christopher Condit <condit at sdsc.edu> wrote:
>
>
> I'm using C# MapScript to build my MapFile.  This is working great.
Now I
> want to query the MapFile programmatically - but can't seem to figure
out
> how to do it.  Is there a tutorial that I'm not seeing?
>
> Here's my code snippet:
>
> layerObj queryLayer = map.getLayerByName("myLayer");
>
> if (null != queryLayer)
>
> {
>
> int count = queryLayer.queryByPoint(myMap, new pointObj(-82, 25, 0,
0),
> mapscript.MS_MULTIPLE, 5.0d);
>
> if (count > 0)
>
>       {
>
> queryLayer.open();
>
> for (int i = 0; i < count; i++)
>
> {
>
> resultCacheMemberObj result = queryLayer.getResult(i);
>
> shapeObj shape = obisLayer.getFeature(result.shapeindex,
result.tileindex);
>
>             }
>
>
>             queryLayer.close();
>
>       }
>
> }
>
>
>
> The resultCacheMemberObj never gets a value, even when query by point
> returns > 0.  Here's my layer definition:
>
> LAYER
>
>     CONNECTION "user/pass"
>
>     CONNECTIONTYPE ORACLESPATIAL
>
>     DATA "SHAPE FROM (SELECT * FROM MYTABLE WHERE NAME LIKE 'S%')
USING
> UNIQUE ROWNUM"
>
>     DUMP TRUE
>
>       METADATA
>
>         "wfs_title" "SimpleWFSTest"
>
>         "gml_include_items"          "all"
>
>       END
>
>     NAME "myLayer"
>
>     PROJECTION
>
>       "init=epsg:4326"
>
>     END
>
>     SIZEUNITS PIXELS
>
>     STATUS DEFAULT
>
>     TOLERANCEUNITS PIXELS
>
>     TRANSPARENCY 100
>
>     TYPE POINT
>
>     UNITS DD
>
>     CLASS
>
>       METADATA
>
>       END
>
>       STYLE
>
>         ANGLE 360
>
>         COLOR 255 0 0
>
>         OUTLINECOLOR 0 255 0
>
>         SIZE 8
>
>         SYMBOL "circle"
>
>       END
>
>     END
>
>   END
>
>
>
> Thanks,
>
>
>
> Chris



More information about the MapServer-users mailing list