[prev in list] [next in list] [prev in thread] [next in thread]
List: postgis-users
Subject: Re: [postgis-users] Attribute query at lat./long. coordinate
From: Richard Greenwood <richard.greenwood () gmail ! com>
Date: 2011-11-27 19:27:49
Message-ID: CAHBySPZ9u8cBbqUbpm86tB4T60Hq5vhbBUOEQJDTu3YaHZpEqQ () mail ! gmail ! com
[Download RAW message or body]
On Sun, Nov 27, 2011 at 12:09 PM, Peter Weilandt <PeterWeilandt@shaw.ca> wr=
ote:
> I=A0came across=A0PostGIS in my search for a tool to use in a website.=A0=
I want
> to develop a website that will use a coordinate (lat & long), which is
> easily obtained from a user on the client side by clicking on a Google ma=
p,
> and then transferring this coordinate to the server side where it will be
> used to=A0 query=A04 shapefiles, with each shapefile containing many
> (800+)=A0overlapping polygons, extracting the values from=A04 fields of t=
he
> attribute table=A0for each polygon that contains this coordinate (drill-d=
own
> results), saving these values in tabular format for immediate=A0processin=
g,
> and then returning=A0derived=A0values to the user on the client side.=A0T=
here is
> no map generation required, only extracting data from the attribute
> table.=A0This sounds simple in concept, but is=A0PostGIS=A0a tool that can
> accomplish the=A0query portion of this process and, if so, are there any
> examples showing the code to use for such a query?
Peter,
I may have been the one who here from your post on the mapserver list.
PostGIS most certainly can do what you describe. A simple example:
SELECT * FROM polygon_table WHERE St_Intersects(
point, polygon_table.geometry);
I cheated a little there - you will need to create a point geometry,
so expanding that example slightly:
SELECT * FROM polygon_table WHERE St_Intersects(
ST_Point($x, $y), polygon_table.geometry);
The above assumes $x and $y came from your user's point click and are
being passed into your SQL query via a server-side programming
language such as PHP.
You may need to define the spatial reference system (SRID) with:
ST_SetSRID( ST_Point($x, $y), 4326 )
HTH,
Rich
-- =
Richard Greenwood
richard.greenwood@gmail.com
www.greenwoodmap.com
_______________________________________________
postgis-users mailing list
postgis-users@postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic