queryByAttribute problem

Troy R. Johnson Troy.Johnson at SDL.USU.EDU
Thu May 12 15:02:58 PDT 2005


Hi all, question:

I have queryByAttribute partially working, but have run into a problem:

I am querying the state boundary shape file as provided in the mapscript
example files (statesp020).  For some reason when I query on the name of
a state, I only get valid results when the state has a single entry in
the shape file.  For example Idaho, Utah, New Mexico work fine, but
Florida, Alaska don't.

Here is the PHP code I'm using:
                        //$search_term = "Idaho";
                        $search_term = "Florida";

                        $myLayer = $map->getLayerByName("US state boundaries");
                        $myLayer->queryByAttributes('STATE', '/'.$search_term.'/', MS_MULTIPLE); 

                        $numberofresults = $myLayer->getNumResults();

Like I mentioned above, Idaho works, $numberofresults is equal to 1.  For Florida
$numberofresulsts is equal to 0.

Any ideas?

My Map file contains:

        LAYER
                NAME "US state boundaries"
                TYPE LINE
                STATUS ON
                DATA "statesp020"

                TEMPLATE "dummy1"       ## added to make layer query work

                PROJECTION
                        "proj=latlong"
                END

                CLASS
                        OUTLINECOLOR 230 230 230
                        SYMBOL 0
                END
        END

Thanks for you help.

Troy



More information about the MapServer-users mailing list