[postgis-users] Examples SQL for spatial searches in post gis egintersect
Abd Muhsen
abd_muhsen at hotmail.com
Tue Apr 3 22:13:56 PDT 2007
Hi,
I believe what Mr. Karim said is right. Using the && as an intersection
operator is better since it allow the system to use the index (GiST, if
available of course). I strongly recommend you to look at the following
links. It might be very useful for you.
4.4. Retrieving GIS Data:
http://postgis.refractions.net/docs/ch04.html#id2849854
6.2.2. OpenGIS Operators:
http://postgis.refractions.net/docs/ch06.html#id2854381
Many thanks,
Abdel-Rahman Muhsen
MSc. Geomatics Engineering student
University of Calgary
Canada
>From: Maher Karim <Maher_Karim at dorsch.com.jo>
>Reply-To: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
>To: PostGIS Users Discussion <postgis-users at postgis.refractions.net>
>CC: postgis-users
><postgis-users at postgis.refractions.net>,postgis-users-bounces
><postgis-users-bounces at postgis.refractions.net>
>Subject: Re: [postgis-users] Examples SQL for spatial searches in post gis
>egintersect
>Date: Wed, 4 Apr 2007 07:14:37 +0200
>
>
>
>
>
>Hi Mohammed,
>
>You can use this example as a guide for you.
>select count(*) from layer1,layer2 where layer1.the_geom&&layer2.the_geom
>and intersects(layer1.the_geom,layer2.the_geom)
>
>you should use the "layer1.the_geom&&layer2.the_geom" because it will
>reduce the query time
>
>Regards
>Maher Abdel Karim
>GIS systems analyst/Programmer
>Dorsch Water and Environment
>
>
>
>|---------+--------------------------------------------->
>| | "Mohammed Wahead" |
>| | <Mohammed.Wahead at cadcorp.com> |
>| | Sent by: |
>| | postgis-users-bounces at postgis.refr|
>| | actions.net |
>| | |
>| | |
>| | 04/03/2007 05:32 PM |
>| | Please respond to PostGIS Users |
>| | Discussion |
>|---------+--------------------------------------------->
>
> >--------------------------------------------------------------------------------------------------------------------------------------------------|
> |
>
>|
> | To: <postgis-users at postgis.refractions.net>
>
>|
> | cc:
>
>|
> | Subject: [postgis-users] Examples SQL for spatial searches in
>post gis eg intersect
>|
>
> >--------------------------------------------------------------------------------------------------------------------------------------------------|
>
>
>
>Hi folks,
>
>
>Can anyone point mw in the right direction. I would like examples of SQL
>syntax for running spatial searches in postgis. For example what is the SQL
>for determining which spatial features intersect with another spatial
>feature.
>
>
>Thanks.
>
>
>Mohammed Wahead
>"Subscribe to Cadcorp eNews at www.cadcorp.com."
>
>GIS & RDBMS Specialist
>Cadcorp
>Computer Aided Development Corporation Ltd Sterling Court,
>Norton Road,
>Stevenage, Herts,
>SG1 2JY, UK
>Tel: +44 (0)1438 731440
>Fax: +44 (0)1438 747997
>
>
>
>
>
>
>**************************************************************************
> **
> This email is confidential and may be privileged and should not be used,
> read or copied by anyone who is not the original intended recipient. If
> you
> have received this email in error please inform the sender and delete it
> from your mailbox or any other storage mechanism. Unless specifically
> stated, nothing in this email constitutes an offer by Cadcorp and Cadcorp
> does not warrant that any information contained in this email is
>accurate.
>
> Cadcorp cannot accept liability for any statements made which are clearly
> the sender's own and not expressly made on behalf of Cadcorp or one of
>its
>
> agents. Please rely on your own virus check. No responsibility is taken
>by
>
> Cadcorp for any damage arising out of any bug or virus infection.
>
>**************************************************************************
> **
>
>
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list