[Mapserver-users] RE: Querying by attributes.

David.Beard at ga.gov.au David.Beard at ga.gov.au
Wed Jun 11 18:46:01 PDT 2003


Marc,
 
I think you need 2 separate layers:
- 1 to display the building layer. This will be the same as your current layer, with FILTERITEM and FILTER removed.
- 1 to query the building layer. This will contain FILTERITEM and FILTER, and does not require any CLASS info, although it does require a CLASS object.
 
If you try to display a layer that contains a filter without parsing a filter value to it, the layer will not display, as the filter will find no features because you're not parsing info to it. I gather that's what you're experiencing at the moment.
 
So, use the query layer to determine the map extent, but the display layer to display the features.
 
Dave

-----Original Message-----
From: mapserver-users-admin at lists.gis.umn.edu [mailto:mapserver-users-admin at lists.gis.umn.edu]On Behalf Of Marc Drouin
Sent: Thursday, 12 June 2003 1:51 AM
To: mapserver-users at lists.gis.umn.edu
Subject: [Mapserver-users] Querying by attributes.



Hi group, 

I'm trying to set a simple query application where a user selects an attribute from a drop down list and mapserver brings up an image where we can see the desired object, in my case, polygons representing buildings.

The drop down list contains the name of the buildings, hence BNAME. 

Here is the section of the mapfile: 

LAYER 
  NAME phill 
  
  PROJECTION 
  "init=epsg:4269" 
  END 
  
  TYPE POLYGON 
  STATUS ON 
  DATA phill 
  FILTERITEM BNAME 
  FILTER "%name%" 
  CLASS 
        NAME "Hill" 
        TEMPLATE "hill.html" 
    OUTLINECOLOR 0 0 0 
    COLOR  34 170 221 
  END 
  HEADER "hill_header.html" 
  FOOTER "hill_footer.html" 
  TOLERANCE 5 
END 

What happens in the application, we can see all the layers that are STATUS ON, except the layer of the buildings that I want to query.  However, if I select a building name from the list, I generates a report eventhough they are not presente in the initial view of the map.

If we comment out the line FILTERITEM, everything works fine. 

Can someone explain why this happens.  Can someone explain the relationship/difference between FILTERITEM and FILTER. 

Thank you 

Marc 





More information about the MapServer-users mailing list