mapscript query question (oracle related)
Christopher Condit
condit at SDSC.EDU
Thu Jan 26 13:36:19 PST 2006
Ok - I finally got the C# MapScript query functionality to work (see
below) - sort of...
I can query raster layers wonderfully - everything works as advertised.
However, when I attempt to query the Oracle layer that appears below, I
always get the same one result back - no matter what lat/lon I use for
my pointObj. The result I get back was the first query I tested, which
makes me suspicious. Is there something special I need to do for an
Oracle query?
mapObj map = new mapObj(@"session.map");
layerObj myLayer = map.getLayerByName("mylayer");
myLayer.queryByPoint(map, new pointObj(-77.0, 18.0, 0, 0),
mapscript.MS_MULTIPLE, 1.0 );
myLayer.open();
for (int i = 0; i < myLayer.getNumResults(); i++)
{
resultCacheMemberObj result = myLayer.getResult(i);
shapeObj shape = myLayer.getFeature(result.shapeindex,
result.tileindex);
for (int j = 0; j < shape.numvalues; j++)
System.Console.Write(shape.getValue(j) + " ");
System.Console.WriteLine("");
}
obisLayer.close();
________________________________
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at lists.umn.edu] On
Behalf Of Christopher Condit
Sent: Thursday, January 19, 2006 11:15 AM
To: MAPSERVER-USERS at lists.umn.edu
Subject: [UMN_MAPSERVER-USERS] mapscript query question
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060126/82a54f12/attachment.htm>
More information about the MapServer-users
mailing list