[mapserver-users] How do I get a feature's index after inserting it in a layer using addFeature in the new release of MapServer? (MS 5.4.1 and C#)

Vagner Sousa vagner.uru at gmail.com
Tue Jul 14 14:46:07 PDT 2009


Hi, there.

I'm experiencing some troubles with the new release of MapServer. You
may take a quick look at the excerpt of code bellow:

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;

        layer.open();
        shapeObj shape = layer.getFeature(shpidx, -1);
        layer.close();
        ...

But I got the following while debugging that (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

The new version of MapServer auto-increments the index property of a
feature as soon as it's added to a layer (unlike older releases). 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 (unlike this, my classindex values are
correct).

am I missing or doing something wrong? It used to work fine before the
last release (namely, the auto-incremented shape.index property).

I've posted a little bit more detailed investigations of the above in
my blog [http://cubicpurunga.blogspot.com].

I'd really appreciate if anyone could spend some time to help me with
that. If you need more details, just let me know.

Thank you very much. Best regards,

Vagner Sousa
AGX Tecnologia [http://www.agx.com.br]



More information about the MapServer-users mailing list