Geo::GDAL  2.0
Geo::OGR::Geometry Class Reference

Spatial data. More...

+ Inheritance diagram for Geo::OGR::Geometry:
+ Collaboration diagram for Geo::OGR::Geometry:

Public Member Functions

public method AddGeometry (scalar other)
 
public method AddGeometryDirectly (scalar other)
 
public method AddPoint (scalar x, scalar y, scalar z)
 
public method AddPoint_2D (scalar x, scalar y)
 
public method AddPoint_3D (scalar x, scalar y, scalar z)
 
public Geo::OGR::Geometry ApproximateArcAngles (hash params)
 
public scalar Area ()
 
public scalar As (hash params)
 
public method AssignSpatialReference (scalar srs)
 
public Geo::OGR::Geometry Boundary ()
 
public Geo::OGR::Geometry Buffer (scalar distance, scalar quadsecs=30)
 
public Geo::OGR::Geometry BuildPolygonFromEdges (scalar BestEffort=0, scalar AutoClose=0, scalar Tolerance=0)
 
public list ByteOrders ()
 
public Geo::OGR::Geometry Centroid ()
 
public Geo::OGR::Geometry Clone ()
 
public method CloseRings ()
 
public Geo::OGR::Geometry Collect (array geometries)
 
public scalar Contains (scalar other)
 
public Geo::OGR::Geometry ConvexHull ()
 
public scalar CoordinateDimension (scalar dimension)
 
public scalar Crosses (scalar other)
 
public Geo::OGR::Geometry Difference (scalar other)
 
public scalar Disjoint (scalar other)
 
public list Dissolve ()
 
public scalar Distance (scalar other)
 
public method Empty ()
 
public scalar Equals (scalar other)
 
public method FlattenTo2D ()
 
public Geo::OGR::Geometry ForceTo (scalar type, ref options)
 
public Geo::OGR::Geometry ForceToCollection (array geometries)
 
public Geo::OGR::Geometry ForceToLineString ()
 
public Geo::OGR::Geometry ForceToMultiLineString (array linestrings)
 
public Geo::OGR::Geometry ForceToMultiPoint (array points)
 
public Geo::OGR::Geometry ForceToMultiPolygon (array polygons)
 
public Geo::OGR::Geometry ForceToPolygon ()
 
public scalar GeometryType ()
 
public list GeometryTypes ()
 
public scalar GetCoordinateDimension ()
 
public method GetCurveGeometry ()
 
public scalar GetDimension ()
 
public list GetEnvelope ()
 
public list GetEnvelope3D ()
 
public scalar GetGeometryCount ()
 
public scalar GetGeometryName ()
 
public scalar GetGeometryRef (scalar index)
 
public scalar GetGeometryType ()
 
public method GetLinearGeometry ()
 
public list GetPoint (scalar index=0)
 
public scalar GetPointCount ()
 
public scalar GetPoint_2D (scalar index=0)
 
public scalar GetPoint_3D (scalar index=0)
 
public Geo::OSR::SpatialReference GetSpatialReference ()
 
public scalar GetX (scalar index=0)
 
public scalar GetY (scalar index=0)
 
public scalar GetZ (scalar index=0)
 
public method HasCurveGeometry ()
 
public Geo::OGR::Geometry Intersection (scalar other)
 
public scalar Intersects (scalar other)
 
public scalar IsEmpty ()
 
public scalar IsRing ()
 
public scalar IsSimple ()
 
public scalar IsValid ()
 
public scalar Length ()
 
public method Move (scalar dx, scalar dy, scalar dz)
 
public scalar Overlaps (scalar other)
 
public list Point (scalar index, scalar x, scalar y, scalar z)
 
public method PointOnSurface ()
 
public array reference Points (arrayref points)
 
public method Segmentize (scalar MaxLength)
 
public method SetCoordinateDimension (scalar dimension)
 
public method SetPoint (scalar index, scalar x, scalar y, scalar z)
 
public method SetPoint_2D (scalar index, scalar x, scalar y)
 
public method SetPoint_3D (scalar index, scalar x, scalar y, scalar z)
 
public Geo::OGR::Geometry Simplify (scalar Tolerance)
 
public method SimplifyPreserveTopology ()
 
public Geo::OGR::Geometry SymDifference (scalar other)
 
public scalar Touches (scalar other)
 
public method Transform (scalar trans)
 
public method TransformTo (scalar srs)
 
public Geo::OGR::Geometry Union (scalar other)
 
public Geo::OGR::Geometry UnionCascaded ()
 
public method Value ()
 
public scalar Within (scalar other)
 
public scalar WkbSize ()
 
public Geo::OGR::Geometry new (hash params)
 
- Public Member Functions inherited from Geo::OGR
public list ByteOrders ()
 
public scalar GeometryTypeModify (scalar type, scalar modifier)
 
public scalar GeometryTypeTest (scalar type, scalar test, scalar type2)
 
public list GeometryTypes ()
 
public Geo::OGR::Driver GetDriver (scalar name)
 
public list GetDriverNames ()
 
public method GetNonLinearGeometriesEnabledFlag ()
 
public Geo::OGR::DataSource GetOpenDS (scalar number)
 
public scalar GetOpenDSCount ()
 
public method OLMD_FID64 ()
 
public Geo::OGR::DataSource Open (scalar name, scalar update=0)
 
public Geo::OGR::DataSource OpenShared (scalar name, scalar update=0)
 
public method SetGenerate_DB2_V72_BYTE_ORDER (scalar Generate_DB2_V72_BYTE_ORDER)
 
public method SetNonLinearGeometriesEnabledFlag ()
 

Detailed Description

Spatial data.

A geometry is spatial data (coordinate values, and a reference to a spatial reference system) organized into one of the geometry types. Geometries can be created from several type of data including a Perl data structure. There are several methods, which modify, compare, test, or compute values from geometries.

Note
Most spatial analysis methods require GEOS to work rigorously.

Definition at line 8514 of file all.pm.

Member Function Documentation

public method Geo::OGR::Geometry::AddGeometry ( scalar  other)

Add a copy of another geometry to a geometry collection

Parameters
othera Geo::OGR::Geometry object
Code:
click to view
public method Geo::OGR::Geometry::AddGeometryDirectly ( scalar  other)
Parameters
othera Geo::OGR::Geometry object
Code:
click to view
public method Geo::OGR::Geometry::AddPoint ( scalar  x,
scalar  y,
scalar  z 
)

Set the data of a point or add a point to a line string. Consider using Geo::OGR::Geometry::Points. Note that the coordinate dimension is automatically upgraded to 25D (3) if z is given.

Parameters
x
y
z[optional] Calls internally the 2D or 3D version depending on the number of parameters.
Code:
click to view
public method Geo::OGR::Geometry::AddPoint_2D ( scalar  x,
scalar  y 
)

Set the data of a point or add a point to a line string. Consider using Geo::OGR::Geometry::Points.

Parameters
x
y
Code:
click to view
public method Geo::OGR::Geometry::AddPoint_3D ( scalar  x,
scalar  y,
scalar  z 
)

Set the data of a point or add a point to a line string. Note that the coordinate dimension is automatically upgraded to 25D (3). Consider using Geo::OGR::Geometry::Points.

Parameters
x
y
z
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::ApproximateArcAngles ( hash  params)

Class method. Create a line string, which approximates an arc.

Note
All angles are in degrees.
Parameters
%paramsnamed parameters, these are:
  • Center center point (default is [0, 0, 0])
  • PrimaryRadius default is 1,
  • SecondaryAxis default is 1,
  • Rotation default is 0,
  • StartAngle default is 0,
  • EndAngle default is 360,
  • MaxAngleStepSizeDegrees default is 4
Returns
a new Geo::OGR::Geometry object.
Code:
click to view
public scalar Geo::OGR::Geometry::Area ( )
Note
a.k.a. GetArea
Returns
the area of the polygon or multipolygon
Code:
click to view
public scalar Geo::OGR::Geometry::As ( hash  params)

Export the geometry into a known format.

Parameters
paramsnamed parameters, either: Text (a.k.a WKT), WKB (a.k.a. Binary) (ByteOrder can also be defined, default is 'XDR'), ISO WKT and WKB, HEXWKB, HEXEWKB (srid can also be given), GML, GeoJSON, Binary.
Note
Uses As<format>/ExportTo<format> methods.
Returns
the geometry in a given format.
Code:
click to view
public method Geo::OGR::Geometry::AssignSpatialReference ( scalar  srs)
Parameters
srsa Geo::OSR::SpatialReference object
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::Boundary ( )
Note
a.k.a. GetBoundary
Returns
the boundary of this geometry as a geometry
Since
1.8.0
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::Buffer ( scalar  distance,
scalar  quadsecs = 30 
)
Parameters
distance
quadsecs
Returns
a new Geo::OGR::Geometry object
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::BuildPolygonFromEdges ( scalar  BestEffort = 0,
scalar  AutoClose = 0,
scalar  Tolerance = 0 
)

Attempt to create a polygon from a collection of lines or from a multilinestring.

Parameters
BestEffortFor future
AutoCloseAssure the first and last points of rings are same.
ToleranceSnap distance.
Exceptions
Severalpossibilities, some are reported, some are general errors.
Returns
a new Geo::OGR::Geometry object (Polygon)
Code:
click to view
public list Geo::OGR::Geometry::ByteOrders ( )

Class method. Same as Geo::OGR::ByteOrders

Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::Centroid ( )
Returns
a new Geo::OGR::Geometry object
Since
1.8.0
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::Clone ( )
Returns
a new Geo::OGR::Geometry object
Code:
click to view
public method Geo::OGR::Geometry::CloseRings ( )
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::Collect ( array  geometries)

Create a geometrycollection from this and possibly other geometries.

Parameters
geometries[optional] More geometries to add to the collection.
Returns
a new Geo::OGR::Geometry object of type geometrycollection.
Code:
click to view
public scalar Geo::OGR::Geometry::Contains ( scalar  other)
Parameters
othera Geo::OGR::Geometry object
Returns
true if this geometry contains the other geometry, false otherwise
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::ConvexHull ( )
Returns
a new Geo::OGR::Geometry object
Code:
click to view
public scalar Geo::OGR::Geometry::CoordinateDimension ( scalar  dimension)
Parameters
dimension[optional]
Returns
2 or 3
Code:
click to view
public scalar Geo::OGR::Geometry::Crosses ( scalar  other)
Parameters
othera Geo::OGR::Geometry object
Returns
true if this geometry crosses the other geometry, false otherwise
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::Difference ( scalar  other)
Parameters
othera Geo::OGR::Geometry object
Returns
a new Geo::OGR::Geometry object
Code:
click to view
public scalar Geo::OGR::Geometry::Disjoint ( scalar  other)
Parameters
othera Geo::OGR::Geometry object
Returns
true if this geometry is disjoint from the other geometry, false otherwise
Code:
click to view
public list Geo::OGR::Geometry::Dissolve ( )

Dissolve a geometrycollection into separate geometries.

Returns
a list of new Geo::OGR::Geometry objects cloned from the collection.
Code:
click to view
public scalar Geo::OGR::Geometry::Distance ( scalar  other)
Parameters
othera Geo::OGR::Geometry object
Returns
the distance to the other geometry
Code:
click to view
public method Geo::OGR::Geometry::Empty ( )

Clear geometry data, i.e., remove all points, or, for a point, set the coordinate dimension as zero.

Code:
click to view
public scalar Geo::OGR::Geometry::Equals ( scalar  other)
Note
a.k.a. Equal (deprecated)
Parameters
othera Geo::OGR::Geometry object
Returns
true if this geometry is equivalent to the other geometry, false otherwise
Code:
click to view
public method Geo::OGR::Geometry::FlattenTo2D ( )
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::ForceTo ( scalar  type,
ref  options 
)

Attempt to make a geometry of type 'type' out of this geometry.

Parameters
typetarget geometry type. One of Geo::OGR::GeometryTypes.
optionsnot used currently.
Returns
a new Geo::OGR::Geometry object.
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::ForceToCollection ( array  geometries)

Create a geometrycollection from the geometry.

Parameters
geometries[optional] More geometries to add to the collection.
Returns
a new Geo::OGR::Geometry object of type geometrycollection.
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::ForceToLineString ( )

Attempt to create a line string from this geometry.

Returns
a new Geo::OGR::Geometry object.
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::ForceToMultiLineString ( array  linestrings)

Attempt to create a multilinestring from the geometry, which must be a linestring.

Parameters
linestrings[optional] More linestrings to add to the collection.
Returns
a new Geo::OGR::Geometry object of type multilinestring.
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::ForceToMultiPoint ( array  points)

Attempt to create a multipoint from the geometry, which must be a point.

Parameters
points[optional] More points to add to the collection.
Returns
a new Geo::OGR::Geometry object of type multipoint.
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::ForceToMultiPolygon ( array  polygons)

Attempt to create a multipolygon from the geometry, which must be a polygon.

Parameters
polygons[optional] More polygons to add to the collection.
Returns
a new Geo::OGR::Geometry object of type multipolygon.
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::ForceToPolygon ( )

Attempt to create a polygon from this geometry.

Exceptions
Nonereported. If this method fails, just a copy is returned.
Returns
a new Geo::OGR::Geometry object.
Code:
click to view
public scalar Geo::OGR::Geometry::GeometryType ( )
Returns
the geometry type of this geometry (one of Geo::OGR::GeometryTypes).
Code:
click to view
public list Geo::OGR::Geometry::GeometryTypes ( )

Class method. Same as Geo::OGR::GeometryTypes

Code:
click to view
public scalar Geo::OGR::Geometry::GetCoordinateDimension ( )
Returns
an integer
Code:
click to view
public method Geo::OGR::Geometry::GetCurveGeometry ( )
Code:
click to view
public scalar Geo::OGR::Geometry::GetDimension ( )
Returns
0, 1, or 2
Code:
click to view
public list Geo::OGR::Geometry::GetEnvelope ( )
Note
In scalar context returns a reference to an anonymous array containing the envelope.
The order of values is different from those returned by Geo::OGR::Layer::GetExtent.
Returns
the envelope ($minx, $maxx, $miny, $maxy)
Code:
click to view
public list Geo::OGR::Geometry::GetEnvelope3D ( )
Note
In scalar context returns a reference to an anonymous array containing the envelope.
Returns
the 3-D envelope ($minx, $maxx, $miny, $maxy, $minz, $maxz)
Since
1.9.0
Code:
click to view
public scalar Geo::OGR::Geometry::GetGeometryCount ( )
Returns
an integer
Code:
click to view
public scalar Geo::OGR::Geometry::GetGeometryName ( )
Deprecated:
use Geo::OGR::Geometry::GeometryType.
Returns
a string
Code:
click to view
public scalar Geo::OGR::Geometry::GetGeometryRef ( scalar  index)
Parameters
indexindex to the geometry, which is a part of this geometry
Returns
a new Geo::OGR::Geometry object whose data is a part of the parent geometry
Code:
click to view
public scalar Geo::OGR::Geometry::GetGeometryType ( )
Deprecated:
use Geo::OGR::Geometry::GeometryType, which returns the type as a string.
Returns
type as an integer
Code:
click to view
public method Geo::OGR::Geometry::GetLinearGeometry ( )
Code:
click to view
public list Geo::OGR::Geometry::GetPoint ( scalar  index = 0)
Parameters
index
Returns
(x,y) or a list with more coordinates
Code:
click to view
public scalar Geo::OGR::Geometry::GetPoint_2D ( scalar  index = 0)
Parameters
index
Returns
(x,y) or a list with more coordinates
Code:
click to view
public scalar Geo::OGR::Geometry::GetPoint_3D ( scalar  index = 0)
Parameters
index
Returns
(x,y) or a list with more coordinates
Code:
click to view
public scalar Geo::OGR::Geometry::GetPointCount ( )
Returns
an integer
Code:
click to view
public Geo::OSR::SpatialReference Geo::OGR::Geometry::GetSpatialReference ( )
Returns
a new Geo::OSR::SpatialReference object
Code:
click to view
public scalar Geo::OGR::Geometry::GetX ( scalar  index = 0)
Parameters
index
Returns
a number
Code:
click to view
public scalar Geo::OGR::Geometry::GetY ( scalar  index = 0)
Parameters
index
Returns
a number
Code:
click to view
public scalar Geo::OGR::Geometry::GetZ ( scalar  index = 0)
Parameters
index
Returns
a number
Code:
click to view
public method Geo::OGR::Geometry::HasCurveGeometry ( )
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::Intersection ( scalar  other)
Parameters
othera Geo::OGR::Geometry object
Returns
a new Geo::OGR::Geometry object
Code:
click to view
public scalar Geo::OGR::Geometry::Intersects ( scalar  other)
Note
a.k.a. Intersect (deprecated)
Parameters
othera Geo::OGR::Geometry object
Returns
true if this geometry intersects with the other geometry, false otherwise
Code:
click to view
public scalar Geo::OGR::Geometry::IsEmpty ( )

Test whether the geometry is empty (has no points, or, for a point, has coordinate dimension of zero).

Returns
boolean
Code:
click to view
public scalar Geo::OGR::Geometry::IsRing ( )

Test if the geometry is a ring. Requires GEOS in GDAL.

Returns
boolean
Code:
click to view
public scalar Geo::OGR::Geometry::IsSimple ( )

Test the simplicity of the geometry (OGC sense). Requires GEOS in GDAL.

Returns
boolean
Code:
click to view
public scalar Geo::OGR::Geometry::IsValid ( )

Test the validity of the geometry (OGC sense). Requires GEOS in GDAL.

Returns
boolean
Code:
click to view
public scalar Geo::OGR::Geometry::Length ( )
Returns
the length of the linestring
Code:
click to view
public method Geo::OGR::Geometry::Move ( scalar  dx,
scalar  dy,
scalar  dz 
)

Move every point of the object as defined by the parameters.

Parameters
dx
dy
dz[optional]
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::new ( hash  params)

Class method.

Parameters
%paramsA named parameter, one of: WKT, WKB, HEXWKB, HEXEWKB, GML, GeoJSON, arc, or GeometryType and optionally Points.
  • GeometryType one the supported geometry types, see Geo::OGR::GeometryTypes.
  • WKT a well known text string, which defines a geometry.
  • WKB a well known binary string, which defines a geometry.
  • HEXWKB WKB in hexadecimal.
  • HEXEWKB PostGIS extended WKB.
  • GML geometry written in Geographic Markup Language.
  • GeoJSON geometry written in GeoJSON (JavaScript Object Notation for Geographic data).
  • arc a reference to a list of values defining an arc: [CenterX, CenterY, CenterZ, PrimaryRadius, SecondaryRadius, Rotation, StartAngle, EndAngle, MaxAngleStepSizeDegrees] (see also Geo::OGR::Geometry::ApproximateArcAngles)
  • Points An anonymous array as in method Geo::OGR::Geometry::Points; Note: requires also GeometryType parameter
Note
uses CreateGeometryFrom* functions from Geo::OGR
Returns
a new Geo::OGR::Geometry object. Usage:
$g = Geo::OGR::Geometry->new(...arguments...);
Code:
click to view
public scalar Geo::OGR::Geometry::Overlaps ( scalar  other)
Parameters
othera Geo::OGR::Geometry object
Returns
true if this geometry overlaps the other geometry, false otherwise
Code:
click to view
public list Geo::OGR::Geometry::Point ( scalar  index,
scalar  x,
scalar  y,
scalar  z 
)

Get or set the point

Parameters
indexThe index of the point. Optional (ignored if given) for Point and Point25D geometries.
x[optional]
y[optional]
z[optional]
Returns
Code:
click to view
public method Geo::OGR::Geometry::PointOnSurface ( )
Code:
click to view
public array reference Geo::OGR::Geometry::Points ( arrayref  points)

Get or set the points of the geometry. The points (vertices) are stored in obvious lists of lists. When setting, the geometry is first emptied. The method uses internally either AddPoint_2D or AddPoint_3D depending on the coordinate dimension of the input data.

Note
The same structure may represent different geometries depending on the actual geometry type of the object.
Parameters
points[optional] A reference to an array. A point is a reference to an array of numbers, a linestring or a ring is a reference to an array of points, a polygon is a reference to an array of rings, etc.
Returns
A reference to an array.
Code:
click to view
public method Geo::OGR::Geometry::Segmentize ( scalar  MaxLength)

Modify the geometry such it has no segment longer than the given length.

Parameters
MaxLengththe given length
Code:
click to view
public method Geo::OGR::Geometry::SetCoordinateDimension ( scalar  dimension)
Parameters
dimension
Code:
click to view
public method Geo::OGR::Geometry::SetPoint ( scalar  index,
scalar  x,
scalar  y,
scalar  z 
)

Set the data of a point or a line string. Note that the coordinate dimension is automatically upgraded to 25D (3) if z is given.

Parameters
index
x
y
z[optional]
Code:
click to view
public method Geo::OGR::Geometry::SetPoint_2D ( scalar  index,
scalar  x,
scalar  y 
)
Parameters
index
x
y
Code:
click to view
public method Geo::OGR::Geometry::SetPoint_3D ( scalar  index,
scalar  x,
scalar  y,
scalar  z 
)

Set the data of a point or a line string. Note that the coordinate dimension is automatically upgraded to 25D (3).

Parameters
index
x
y
z
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::Simplify ( scalar  Tolerance)

Simplify the geometry.

Parameters
Tolerancethe length tolerance for the simplification
Since
1.8.0
Returns
a new Geo::OSR::Geometry object
Code:
click to view
public method Geo::OGR::Geometry::SimplifyPreserveTopology ( )
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::SymDifference ( scalar  other)

Compute symmetric difference.

Note
a.k.a. SymmetricDifference
Parameters
othera Geo::OGR::Geometry object
Returns
a new Geo::OGR::Geometry object
Since
1.8.0
Code:
click to view
public scalar Geo::OGR::Geometry::Touches ( scalar  other)
Parameters
othera Geo::OGR::Geometry object
Returns
true if this geometry touches the other geometry, false otherwise
Code:
click to view
public method Geo::OGR::Geometry::Transform ( scalar  trans)
Parameters
transa Geo::OSR::CoordinateTransformation object
Code:
click to view
public method Geo::OGR::Geometry::TransformTo ( scalar  srs)
Parameters
srsa Geo::OSR::SpatialReference object
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::Union ( scalar  other)
Parameters
othera Geo::OGR::Geometry object
Returns
a new Geo::OGR::Geometry object
Code:
click to view
public Geo::OGR::Geometry Geo::OGR::Geometry::UnionCascaded ( )
Returns
a new Geo::OGR::Geometry object
Since
1.8.0
Code:
click to view
public method Geo::OGR::Geometry::Value ( )
Code:
click to view
public scalar Geo::OGR::Geometry::Within ( scalar  other)
Parameters
othera Geo::OGR::Geometry object
Returns
true if this geometry is within the other geometry, false otherwise
Code:
click to view
public scalar Geo::OGR::Geometry::WkbSize ( )
Returns
an integer
Code:
click to view

The documentation for this class was generated from the following file: