[postgis-users] PostGIS Capabilities

Paul Ramsey pramsey at refractions.net
Thu Feb 19 07:15:48 PST 2004


On Thursday, February 19, 2004, at 02:03 AM, Chris Haste wrote:

> Given an irregular closed polygon can we perform SQL statements along 
> the lines of "give me all the points that reside within the polygon?

SELECT POINTS FROM MYTABLE WHERE 
CONTAINS(GEOMETRYFROMTEXT('POLYGON(..)', SRID), POINTS)


>  Given the same polygon can we obtain all the lines that intersect the 
> polygon?

SELECT LINES FROM MYTABLE WHERE NOT 
DISJOINT(GEOMETRYFROMTEXT('POLYGON(..)', SRID), LINES)


>  For the above are the coordinates of the intersection points 
> calculated and obtainable?

SELECT INTERSECTION(LINES, GEOMETRYFROMTEXT('POLYGON(..)',SRID)) FROM 
MYTABLE WHERE NOT DISJOINT(GEOMETRYFROMTEXT('POLYGON(..)', SRID), LINES)


>  Can we obtain all the points within a certain radius of a specified 
> points?

SELECT * FROM MYTABLE WHERE 
DISTANCE(POINTS,GEOMETRYFROMTEXT('POINT(..)',SRID)) > RADIUS

> Can we obtain all the lines that reside entirely (without intersecting 
> the boundary) within a circle or an ellipse?

If you construct the circle or ellipse into a polygon that approximates 
the shape, you can use the WITHIN() or CONTAINS() functions for a 
strict test of containment.

> Is it possible to specify the segments of a polygon as being either a 
> straight line, a rhumb line or a great circle? This is necessary to 
> avoid problems to do with the curvature of the earth.

No. You can calculate length_spheroid() directly on the spheroid, but 
that is the only geodetic function we have so far.

>  
      Paul Ramsey
      Refractions Research
      Email: pramsey at refractions.net
      Phone: (250) 885-0632




More information about the postgis-users mailing list