[mapserver-users] Spatial and Attribute Querying

Paul Ramsey pramsey at refractions.net
Mon Jul 23 15:52:20 PDT 2001


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