queryByAttributes...

Paul james pauljame at GMAIL.COM
Tue Apr 12 14:07:26 EDT 2005


Thank you Sean... I thoung '1' means sucess ...

so, my queryByAttributes() is always returning 1 (Failure)... I dont
know why... I think is problem with any parameter...

string value = "'[state]' = 'test'";
layer.queryByAttributes(mp,"state", value, 0)

I have a state column in my table :  > state varchar
And I have a 'test' line as well ... And the 'test' point is in my
extents mp ...
so, any other idea?

thank you...

On Apr 12, 2005 2:45 PM, Sean Gillies <sgillies at frii.com> wrote:
> On Apr 12, 2005, at 11:17 AM, Paul james wrote:
>
> > I=B4m with problems using queryByAttributes... getResult(0) always
> > return n=
> > ull...
> > any idea?
> > ps.: using c#
> >
> > thx
> >
> > =20
> >
> > layer =3D mp.getLayerByName("layer");
> > string value =3D "'[oid]' =3D '32141'";
> > if ((layer.queryByAttributes(mp,"oid", value, 0))=3D=3D1)
> > {
> >       resultCacheMemberObj result =3D new resultCacheMemberObj();
> >       result =3Dlayer.getResult(0);
> > }
> >
> >
>
> Is it just me, or is the listserv mangling this (and other) emails?
>
> I'm assuming you are using MapServer 4.4.  First, of all, you should
> generally compare integer results from mapscript to
> mapscript.MS_SUCCESS (0) and mapscript.MS_FAILURE (1).  Second, I think
> you really should be doing something like this:
>
>     layerObj layer = mp.getLayerByName("layer");
>     ...
>     layer.queryByAttributes(...);
>     resultCacheObj results = layer.getResults();
>     if (results)
>     {
>         resultCacheMemberObj result = results.getResult(0);
>     }
>
> Keep in mind that the extents of your 'mp' map are used to filter
> results.  If you query by attributes for a feature outside the map
> extents, it will not be found.
>
> cheers,
> Sean
>
> --
> Sean Gillies
> sgillies at frii dot com
> http://users.frii.com/sgillies
>
>



More information about the mapserver-users mailing list