[Mapserver-users] Itemquery - getting started, having problems

Richard Greenwood rich at greenwoodmap.com
Sun Apr 18 22:06:17 EDT 2004


Mike Reilly wrote:

> Bottom posting - see response at bottom.
> 
>> From: Richard Greenwood <rich at greenwoodmap.com>
>> To: Mike Reilly <mikereilly_7 at hotmail.com>
>> CC: mapserver-users at lists.gis.umn.edu
>> Subject: Re: [Mapserver-users] Itemquery - getting started, having 
>> problems
>> Date: Sun, 18 Apr 2004 16:53:43 -0600
>>
>> Mike Reilly wrote:
>>
>>> Hi:
>>>
>>> I'm just starting to try to work with itemquery and itemnquery.  I've 
>>> read the cgi reference, the mapfile reference, trolled through the 
>>> archives and spent a number of hours trying to get this started.  I'm 
>>> obvoiusly missing something significant, however.  Here's what I'm 
>>> working with:
>>>
>>> A number of shapefiles to create maps from - I have all other 
>>> functions working on my application - can zoom, pan, query the map, 
>>> etc.  What I want to do now is be able to link to the map from other 
>>> pages in order to display a single site - either point or polygon 
>>> from one of two shapfiles - tuspoints and mergeplys.  Both of these 
>>> shapefiles have a field (attribute?) named SITEID.  I want to be able 
>>> to display these point or poly sites on my map based on whether they 
>>> match a specific SITEID value.  After looking through the docs and 
>>> archives, I figured that forming a URL with mode=itemquery was what I 
>>> wanted (am I going in the right direction here?).  After looking at 
>>> one of Richard Greenwood's sites, I figured this was probably teh 
>>> correct way to go.
>>>
>>> I have not made any modifications to the shapefile I'm using in order 
>>> to use mode=itemnquery (am I missing something here?).  Here's an 
>>> example of a URL I tried to create in order to get my map displayed 
>>> correctly:
>>>
>>> http://192.168.0.3/cgi-bin/mapserv.exe?map=f:/program%20files/apache%20group/apache2/htdocs/Kitasoo/tus2-1.map&mode=itemquery&qitem=SITEID&qstring=1010&layer=landpl+streamln+lakespl+conmajl&qlayer=tuspoints 
>>>
>>>
>>>
>>> This gives me the following output:
>>>
>>> msQueryByAttributes(): Search returned no results. No matching 
>>> record(s) found.
>>>
>>> In the tuspoints layer, there is a site with a SITEID that has the 
>>> value 1010.  Not sure why I'm getting no matching records found.  Can 
>>> anyone point me in the right direction here?
>>
>>
>> Two things to try:
>>
>> 1. Be sure that the object having SITEID = 1010 is within the extents 
>> that you have defined in your map file.
>>
>> 2. Add 'mapext=shapes' to your query string.
>>
>>
>> -- 
>> Richard Greenwood
>> www.greenwoodmap.com
>> _______________________________________________
>> Mapserver-users mailing list
>> Mapserver-users at lists.gis.umn.edu
>> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 
> 
> I have added mapext=shapes to the URL, and the extents as defined in my 
> mapfile include the entire data set in all shape files.  I've also tried 
> using other SITEID numbers.  Here is a snippet from my map file defining 
> some of the basics as well as including two shapefiles in the layer 
> (skipping inclusion of the other 20+ layers):
> 
>  NAME           EX2.1_
>  IMAGETYPE      png
>  EXTENT         768897.25886 810841.50306 876598.91242 913853.62854  # LAEA
>  #EXTENT         -97.5 41.619778 -82.122902 49.38562 # Geographic
>  SIZE          792 592
>  SHAPEPATH      "f:/program files/apache group/apache2/htdocs/Kitasoo/tus"
>  SYMBOLSET      "f:/program files/apache 
> group/apache2/htdocs/Kitasoo/symbols/symbols35.sym"
>  FONTSET        "f:/fonts/fonts.list"
>  IMAGECOLOR    207 245 255
>  WEB
>    TEMPLATE  'f:/program files/apache 
> group/apache2/htdocs/Kitasoo/tus2-1.html'
>    IMAGEPATH 'f:/program files/apache group/apache2/htdocs/tmp/'
>    IMAGEURL  'http://192.168.0.3/tmp/'
>  END
> 
> LAYER # TUS polygon layer begins here
>    NAME         tuspoints
>    DATA         "mergeplys"
>    STATUS       ON
>    TYPE         POLYGON
>    TOLERANCE 3
>    PROJECTION
> #      "init=epsg:4326"
>    END
>    CLASSITEM "LOCATION"
>    CLASS
>      EXPRESSION   "land"
>      COLOR        160 160 255
>      TEMPLATE     "templates/land_query.html"
>      OUTLINECOLOR 0 200 0
>    END
>    CLASS
>      EXPRESSION   "Ocean"
>      TEMPLATE       "templates/land_query.html"
>      COLOR        100 255 100
>      OUTLINECOLOR 0 255 0
>    END
>  END
> # ***** display all point layers begin here.
>  LAYER
>    NAME    "tuspoints"
>    DATA        "tus points"
>    STATUS      ON
>    TYPE     POINT
>    MAXSCALE    5000000000
>    TOLERANCE   3
>    CLASS
>      SYMBOL    7
>      SIZE    6
>      TEMPLATE  "templates/pointdata_query.html"
>      COLOR    255 0 0
>    END
>  END
> 

Looks like you need a FILTERITEM and a FILTER in your map file. For example:

     FILTERITEM SITEID
     FILTER "%SITEID%"

Also be sure you have a querymap object defined in your map file. For 
example:

QUERYMAP	
     STATUS ON
     STYLE SELECTED
END

(But this would not cause the error you are reporting.)

-- 
Richard Greenwood
www.greenwoodmap.com



More information about the mapserver-users mailing list