<div>Hi there,</div>
<div>&nbsp;</div>
<div>I am trying to get the shape objects with the function getFeature(shapeindex,tileindex), but it seems that the layer can not be opened for getFeature function, here is the source code:</div>
<div>&nbsp;</div>
<div><font size="2">
<p></p></font><font color="#0000ff" size="2">Public</font><font size="2"> </font><font color="#0000ff" size="2">Function</font><font size="2"> getShapeFromLayer(</font><font color="#0000ff" size="2">ByVal</font><font size="2">
 aryQueryExt </font><font color="#0000ff" size="2">As</font><font size="2"> Array, </font><font color="#0000ff" size="2">ByVal</font><font size="2"> objLayer </font><font color="#0000ff" size="2">As</font><font size="2"> layerObj, _

<p></p></font><font color="#0000ff" size="2">ByVal</font><font size="2"> objParentMap </font><font color="#0000ff" size="2">As</font><font size="2"> mapObj) </font><font color="#0000ff" size="2">As</font><font size="2"> shapeObj

<p></p></font><font color="#008000" size="2">' get all the shape objects within the aryQueryExt specified area,</font><font size="2">
<p></p></font><font color="#008000" size="2">' where the values should be geographic coordinates,</font><font size="2">
<p></p></font><font color="#008000" size="2">' the format should be ayrQueryExt(XMin, YMin, XMax, YMax)</font><font size="2">
<p></p></font><font color="#0000ff" size="2">Try</font><font size="2">
<p></p></font><font color="#0000ff" size="2">Dim</font><font size="2"> tempRect </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">New</font><font size="2"> rectObj(aryQueryExt(0), aryQueryExt(1), aryQueryExt(2), aryQueryExt(3), 0)

<p></p></font><font color="#008000" size="2">' indicate the success or failure</font><font size="2">
<p></p></font><font color="#0000ff" size="2">Dim</font><font size="2"> intQuery </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</font><font size="2">
<p></p></font><font color="#0000ff" size="2">Dim</font><font size="2"> tempShape </font><font color="#0000ff" size="2">As</font><font size="2"> shapeObj = </font><font color="#0000ff" size="2">Nothing</font><font size="2">

<p>intQuery = objLayer.queryByRect(objParentMap, tempRect)</p>
<p></p></font><font color="#008000" size="2">' open the layer to get features</font><font size="2">
<p></p></font><font color="#0000ff" size="2">If</font><font size="2"> intQuery = 1 </font><font color="#0000ff" size="2">Then</font><font size="2">
<p></p></font><font color="#0000ff" size="2">Dim</font><font size="2"> intOpen </font><font color="#0000ff" size="2">As</font><font size="2"> </font><font color="#0000ff" size="2">Integer</font><font size="2">
<p>intOpen = objLayer.open()</p>
<p></p></font><font color="#0000ff" size="2">Dim</font><font size="2"> resultMem </font><font color="#0000ff" size="2">As</font><font size="2"> resultCacheMemberObj = </font><font color="#0000ff" size="2">Nothing</font><font size="2">

<p>resultMem = objLayer.getResult(intQuery)</p>
<p>tempShape = objLayer.getFeature(resultMem.shapeindex, resultMem.tileindex)</p>
<p>objLayer.close()</p>
<p></p></font><font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">If</font><font size="2">
<p></p></font><font color="#0000ff" size="2">Return</font><font size="2"> tempShape
<p></p></font><font color="#0000ff" size="2">Catch</font><font size="2"> ex </font><font color="#0000ff" size="2">As</font><font size="2"> Exception
<p></p></font><font color="#0000ff" size="2">Throw</font><font size="2"> </font><font color="#0000ff" size="2">New</font><font size="2"> Exception(</font><font color="#800000" size="2">&quot;failed to get Features from the Layer!&quot;
</font><font size="2">, ex)
<p></p></font><font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">Try</font><font size="2">
<p></p></font><font color="#0000ff" size="2">End</font><font size="2"> </font><font color="#0000ff" size="2">Function</font>
<p><font color="#0000ff" size="2"><font color="#000000">the intQuery&nbsp;value is 1, means that the query is successful, but the intOpen is always 0, seems that the layer can not be opened for getFeature function. The layer queried is a memory layer created with a function on the fly, I don't know if this is a problem for the getFeature function. 
</font></font></p>
<p><font color="#0000ff" size="2"><font color="#000000">the scenario of this function in my application is:</font></font></p>
<p><font size="2">a new layer is created on the fly with the data from the Oracle Spatial database when the first user request comes in, and this layer will be always the same through out a user session, so I&nbsp;am trying to get the shape objects from the layer and store them into a data table, so that I can create a new layer with these shape objects without connection with the oracle spatial database any more, and this may improve the mapserver performance, since I do not need to access the database anymore every time when a new map image is needed to be rendered.
</font></p>
<p><font size="2">and the shape object in the queried layer may be a point or a polygon.</font></p>
<p><font size="2">BTW: the map extent unit of the map object is meter, but the queried layer has&nbsp;decimal degree (WGS84 layer)&nbsp;as map unit, but the values of the query rectangle is also in degree unit, I don't know if this will cause the getFeature problem. Just for info.
</font></p>
<p>thanks for any clues to solve this problem.</p>
<p><font color="#0000ff" size="2">&nbsp;</font></p></div>