Sie sind auf Seite 1von 2

PostGIS 1.5.

1 Manual
163 / 315

Examples
SELECT tbl1.column1,
FROM
( VALUES
(1, LINESTRING (0
( VALUES
(2, LINESTRING (0
(3, LINESTRING (1
(4, LINESTRING (0

tbl2.column1, tbl1.column2 ~ tbl2.column2 AS contains

0, 3 3)::geometry)) AS tbl1,
0, 4 4)::geometry),
1, 2 2)::geometry),
0, 3 3)::geometry)) AS tbl2;

column1 | column1 | contains


---------+---------+---------1 |
2 | f
1 |
3 | t
1 |
4 | t
(3 rows)

See Also
@, &&

7.7.13 ~=
Name
~= Returns TRUE if As bounding box is the same as Bs.

Synopsis
boolean ~=( geometry A , geometry B );
boolean ~=( geography A , geography B );

Description
The ~= operator returns TRUE if the bounding box of geometry/geography A is the same as the bounding box of geometry/geography B.

Note
This operand will make use of any indexes that may be available on the geometries.

Availability: 1.5.0 changed behavior


Warning
This operator has changed behavior in PostGIS 1.5 from testing for actual geometric equality to only checking for
bounding box equality. To complicate things it also depends on if you have done a hard or soft upgrade which behavior
your database has. To find out which behavior your database has you can run the query below. To check for true
equality use ST_OrderingEquals or ST_Equals and to check for bounding box equality =; operator is a safer option.

PostGIS 1.5.1 Manual


164 / 315

Examples
select LINESTRING(0 0, 1 1)::geometry ~= LINESTRING(0 1, 1 0)::geometry as equality;
equality
|
-----------------+
t
|

The above can be used to test if you have the new or old behavior of ~= operator.

See Also
ST_Equals, ST_OrderingEquals, =

7.8 Spatial Relationships and Measurements


7.8.1 ST_Area
Name
ST_Area Returns the area of the surface if it is a polygon or multi-polygon. For "geometry" type area is in SRID units. For
"geography" area is in square meters.

Synopsis
float ST_Area(geometry g1);
float ST_Area(geography g1);
float ST_Area(geography g1, boolean use_spheroid);

Description
Returns the area of the geometry if it is a polygon or multi-polygon. Return the area measurement of an ST_Surface or
ST_MultiSurface value. For geometry Area is in the units of the srid. For geography area is in square meters and defaults
to measuring about the spheroid of the geography (currently only WGS84). To measure around the faster but less accurate sphere
-- ST_Area(geog,false).
This method implements the OpenGIS Simple Features Implementation Specification for SQL 1.1.
This method implements the SQL/MM specification. SQL-MM 3: 8.1.2, 9.5.3

Examples
Return area in square feet for a plot of Massachusetts land and multiply by conversion to get square meters. Note this is in square
feet because 2249 is Mass State Plane Feet
SELECT ST_Area(the_geom) As sqft, ST_Area(the_geom)*POWER(0.3048,2) As sqm
FROM (SELECT
ST_GeomFromText(POLYGON((743238 2967416,743238 2967450,
743265 2967450,743265.625 2967416,743238 2967416)),2249) ) As foo(the_geom);
sqft
|
sqm
---------+------------928.625 | 86.27208552

Das könnte Ihnen auch gefallen