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

Vagner Sousa vagner.uru at gmail.com
Tue Jul 14 17:58:11 EDT 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:

   resultCacheObj results = layer.getResults();

   for (int i = 0; i < results.numresults; i++)
       int shpidx = results.getResult(i).shapeindex;

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

But I got the following while debugging that (Visual Studio IDE):

   classindex: 0
   shapeindex: 1
   tileindex: -1
   classindex: 1
   shapeindex: 1
   tileindex: -1
   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

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 [cubicpurunga dot blogspot dot 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

More information about the mapserver-users mailing list