[mapserver-users] Spatial and Attribute Querying

Stephen Lime steve.lime at dnr.state.mn.us
Tue Jul 24 08:48:43 EDT 2001


I did want to add one more alternative. With 3.5 you could do this:

  - a normal point "nquery" setting appropriate tolerances for the spatial query
  - set a FILTER in the mapfile or dynamically as well

The FILTER will be applied before checking the spatial requirement. Note that the FILTER stays set when building a resulting querymap which may not be what you want. However, there's a workaround for that using a cached query to build the image you want. Anyway, this should work as a one step solution to your problem.

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937
>>> Paul Ramsey <pramsey at refractions.net> 07/23/01 22:15 PM >>>
A combination of mapserver, php, and postgis should do it. You use
mapserver for the map interface, pulling drawable features from the
postgis datasource. A query click on the map goes to a php page which
takes the coordinate information from the query and does a SQL query on
the postgis database, something like

select * from thetable where attr1 = 'val1' and attr2 = 'vals' and
distance(geom,'POINT(x y)') < radius and geom && 'BOX3D(framex1
framey1,framex2 framey2)'::box3d.

The first two tests are your attribute queries, the third is the
distance portion and the fourth is a subsetting operation which will use
the spatial index, to ensure that the process does not get bogged down
by processing too many records.

Eric Steele wrote:
> 
> Hi,
>  I'm looking for a way to combine spatial and attribute queries. I want to
> be able to do something like "find all sites within X distance with
> attributes Y and Z".
>  A push in the right direction would be greatly appreciated.
> Thanks,
> Eric
> 
> Eric M. Steele
> Senior Research Technologist
> Land Analysis Laboratory,
> Penn State University
> EricSteele at psu.edu
> 814-865-2307

-- 
      __
     /
     | Paul Ramsey
     | Refractions Research
     | Email: pramsey at refractions.net
     | Phone: (250) 885-0632
     \_




More information about the mapserver-users mailing list