swig mapscript interface

Tamas Szekeres szekeres.tamas at FREEMAIL.HU
Tue Feb 7 17:01:28 EST 2006


Cris,


For C# you should access the field value by index as

string myvalue  = myshape.getValue(index);

index should be less than shapeObj.numvalues.

Currently the field access by array (shapeObj.values) cannot be used due to
the absence of a C# typemap for the string array.

To access the value by field name your shape should belong to a layer.
You could achieve similar functionality as implemented in php like

if (myshape != null && mylayer != null && myshape.numvalues ==
mylayer.numvalues)
{
  for (int i=0; i<mylayer.numitems; i++)
  {
    if (mylayer.getItem(i) == "Country_Code")
    {
      myvalue = myshape.getValue(i);
    }
  }
}


Best Regards,

Tamas Szekeres





On Mon, 6 Feb 2006 22:34:43 -0800, Christopher Condit <condit at SDSC.EDU> wrote:

>I'm curious if there's a way to get access to the shapeObj field names
>in non-PHP MapScript applications.
>
>In PHP, you can get a shape object (as a result of a query) and grab the
>valued of field with a string index: $myValue =
>shape.values["Country_Code"];
>
>I'm using c# for my application and I'm curious if there is anything
>similar - or another way to get access to the field names?
>
>
>
>Thanks,
>
>
>
>Chris
>
>



More information about the mapserver-users mailing list