[mapserver-users] Problems with shape.index after using layer.addFeature (MapServer 5.4.1 and .net C#)

Vagner Sousa vagner.uru at gmail.com
Tue Jul 14 16:13:49 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:


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
here<http://cubicpurunga.blogspot.com/2009/07/shapeobjindex-round-two-fight.html>and
here <http://cubicpurunga.blogspot.com/2009/07/shapeobjindex-in-ms-5x.html>in
my blog.

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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090714/bc1881f0/attachment.html


More information about the mapserver-users mailing list