Module: PostgisAdapter::Functions::PolygonFunctions
- Defined in:
- lib/postgis_adapter/functions/common.rb
Overview
Polygon
Instance Method Summary collapse
-
#area(transform = nil) ⇒ Object
The area of the geometry if it is a polygon or multi-polygon.
-
#closed? ⇒ Boolean
(also: #is_closed?)
True if the LineString’s start and end points are coincident.
-
#covers?(other) ⇒ Boolean
True if no point in Geometry B is outside Geometry A.
-
#perimeter(transform = nil) ⇒ Object
Returns the 2D perimeter of the geometry if it is a ST_Surface, ST_MultiSurface (Polygon, Multipolygon).
-
#perimeter3d ⇒ Object
Returns the 3-dimensional perimeter of the geometry, if it is a polygon or multi-polygon.
Instance Method Details
#area(transform = nil) ⇒ Object
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. Area is in the units of the spatial reference system.
Accepts optional parameter, the srid to transform to.
Returns Float ST_Area(geometry g1);
836 837 838 |
# File 'lib/postgis_adapter/functions/common.rb', line 836 def area transform=nil postgis_calculate(:area, self, { :transform => transform }).to_f end |
#closed? ⇒ Boolean Also known as: is_closed?
True if the LineString’s start and end points are coincident.
This method implements the OpenGIS Simple Features Implementation Specification for SQL.
SQL-MM defines the result of ST_IsClosed(NULL) to be 0, while PostGIS returns NULL.
Returns boolean ST_IsClosed(geometry g);
874 875 876 |
# File 'lib/postgis_adapter/functions/common.rb', line 874 def closed? postgis_calculate(:isclosed, self) end |
#covers?(other) ⇒ Boolean
True if no point in Geometry B is outside Geometry A
This function call will automatically include a bounding box comparison that will make use of any indexes that are available on the geometries. To avoid index use, use the function _ST_Covers.
Do not call with a GEOMETRYCOLLECTION as an argument Do not use this function with invalid geometries. You will get unexpected results.
Performed by the GEOS module.
Returns Boolean ST_Covers(geometry geomA, geometry geomB);
893 894 895 |
# File 'lib/postgis_adapter/functions/common.rb', line 893 def covers? other postgis_calculate(:covers, [self, other]) end |
#perimeter(transform = nil) ⇒ Object
Returns the 2D perimeter of the geometry if it is a ST_Surface, ST_MultiSurface (Polygon, Multipolygon). 0 is returned for non-areal geometries. For linestrings use ‘length’. Measurements are in the units of the spatial reference system of the geometry.
Accepts optional parameter, the sridto transform to.
Returns Float ST_Perimeter(geometry g1);
850 851 852 |
# File 'lib/postgis_adapter/functions/common.rb', line 850 def perimeter transform=nil postgis_calculate(:perimeter, self, { :transform => transform }).to_f end |
#perimeter3d ⇒ Object
Returns the 3-dimensional perimeter of the geometry, if it is a polygon or multi-polygon. If the geometry is 2-dimensional, then the 2-dimensional perimeter is returned.
Returns Float ST_Perimeter3D(geometry geomA);
860 861 862 |
# File 'lib/postgis_adapter/functions/common.rb', line 860 def perimeter3d postgis_calculate(:perimeter3d, self).to_f end |