The new release of MapServer auto-increments the index property of a feature as soon as it is added to a layer. That's OK, but:
1- When we add features to a layer, they are automatically numbered. (ok)
2- When we try to get any of that features, we get a fixed index = 1. (not ok)
thus, I can't perform a query in my database to provide the user detailed information about the "clicked" point-of-interest.
For example, if I add some sample shapes to a point layer:
CoffeeShop? A (it gets index = 1) (ok)
CoffeeShop? B (it gets index = 2) (ok)
CoffeeShop? C (it gets index = 3) (ok)
Now, let's say the user wants to get information about the "C" CoffeeShop?. MapServer will return:
myresults(0).shapeindex: 1 (not ok)
myresults(1).shapeindex: 1 (not ok)
myresults(2).shapeindex: 1 (not ok)
The classindex property of each result are OK but what about the shapeindex? Doesn't it should be evaluated with 1, 2, 3, etc?
So, I'm not able to perform a "select * from poi where poi.id = 3" -like query because all results have its indices = 1.
I think a important point is: if mapserver increments the indices, why don't recover then later?
Additional details:
Code example (just an important fragment):
if (ret == (int)MS_RETURN_VALUE.MS_SUCCESS)
{
resultCacheObj results = layer.getResults();
for (int i = 0; i < results.numresults; i++)
{
int shpidx = results.getResult(i).shapeindex;
...
shapeObj shape = layer.getFeature(shpidx, -1);
...
I got the following while debugging the code above (Visual Studio IDE):
results.getResult(0)
{OSGeo.MapServer.resultCacheMemberObj}
classindex: 0
shapeindex: 1
tileindex: -1
results.getResult(1)
{OSGeo.MapServer.resultCacheMemberObj}
classindex: 1
shapeindex: 1
tileindex: -1
results.getResult(2)
{OSGeo.MapServer.resultCacheMemberObj}
classindex: 0
shapeindex: 1
tileindex: -1
Thus, it's easy to realize that we'll always get the wrong feature when trying the follow:
shapeObj shape = layer.getFeature(shpidx, -1);
Then, I took a look at the method
int msQueryByRect(mapObj *map, int qlayer, rectObj rect)
from the MapServer 5.4.1 source code and I didn't find any statement that would may restore the actual (auto-numbered) shapeindex value of the feature (but the classindex value I did so).
I know there's a couple of shape.setValue() and shape.getValue() functions one may use to store and recover values, but I'm not able to get the actual index value after performing a feature query, hence these functions just can't help us.
I hope I've provided correct and clear information.
Best regards,
Vagner