[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgis-users
Subject:    Re: [postgis-users] spatial analysis - contains
From:       maplabs () light42 ! com
Date:       2011-04-25 19:57:36
Message-ID: 20110425155736.hcoqm2bg2884kkw4 () webmail ! light42 ! com
[Download RAW message or body]



>
> From: shreyes shiv <shivshreyes@gmail.com>
> Subject: [postgis-users] spatial analysis - contains
>
> I have two shape files loaded onto Postgis. Both are of the same spatial
> extent. 
> I wan to know wat all polygons of one shape file lies in the polygon of the
> other shape file. How to do u i write the query for this. 
> Please help
>

Say there are two tables from the Natural Earth data set,  found at 
  http://www.naturalearthdata.com/

  10m_lakes 
  10m_admin_1_states_provinces

Say you want to find all lakes that occur in a single state/province 
called "California"

SELECT
  lakes.name1
FROM
  "10m_lakes" as lakes,
  "10m_admin_1_states_provinces" as provs
WHERE
  st_contains( provs.the_geom, lakes.the_geom) AND
  provs.name_1 = 'California'

Is that what you were asking?

==
Brian Hamlin
planetwork.net
OSGEo California Chapter
(415) 717-4462 cell

> -- shreyes shiv
> email: shivshreyes@gmail.com
> phone: 9557975780
> IIRS(Indian Institute of Remote Sensing)
> No. 4, Kalidas Road, Dehradun-248001, Uttarakhand, India


_______________________________________________
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