Geo::GDAL  1.11
Geo::OGR::Geometry Class Reference
Inheritance diagram for Geo::OGR::Geometry:
Inheritance graph
[legend]

List of all members.

Public Class Methods

Geo::OGR::Geometry new (scalar type=scalar Geo::OGR::wkbUnknown, scalar WKT=undef, scalar WKB=undef, scalar GML=undef)
Geo::OGR::Geometry create (scalar type)
Geo::OGR::Geometry create (hash params)

Public Object Methods

 FlattenTo2D ()
scalar CoordinateDimension (scalar dimension)
scalar GetCoordinateDimension ()
 SetCoordinateDimension (scalar dimension)
scalar GetDimension ()
scalar AsText ()
scalar AsBinary (scalar byte_order= 'XDR')
scalar AsGML ()
scalar AsKML ()
scalar AsJSON ()
 AddPoint (scalar x, scalar y, scalar z)
 AddPoint_2D (scalar x, scalar y)
 AddPoint_3D (scalar x, scalar y, scalar z)
 SetPoint (scalar index, scalar x, scalar y, scalar z)
 SetPoint_2D (scalar index, scalar x, scalar y)
 SetPoint_3D (scalar index, scalar x, scalar y, scalar z)
scalar GetPointCount ()
list GetPoint (scalar index=0)
scalar GetPoint_2D (scalar index=0)
scalar GetPoint_3D (scalar index=0)
scalar GetX (scalar index=0)
scalar GetY (scalar index=0)
scalar GetZ (scalar index=0)
list Point (scalar index, scalar x, scalar y, scalar z)
listref Points (listref points)
 Empty ()
scalar IsEmpty ()
scalar IsRing ()
scalar IsSimple ()
scalar IsValid ()
 Move (scalar dx, scalar dy, scalar dz)
 AddGeometryDirectly (scalar other)
 AddGeometry (scalar other)
Geo::OGR::Geometry Clone ()
scalar GeometryType ()
scalar Length ()
scalar Area ()
scalar GetGeometryCount ()
scalar GetGeometryRef (scalar index)
Geo::OGR::Geometry ConvexHull ()
Geo::OGR::Geometry BuildPolygonFromEdges (scalar BestEffort=0, scalar AutoClose=0, scalar Tolerance=0)
Geo::OGR::Geometry Collect (list geometries)
list Dissolve ()
Geo::OGR::Geometry ForceToPolygon ()
Geo::OGR::Geometry ForceToMultiPoint (list points)
Geo::OGR::Geometry ForceToMultiLineString (list linestrings)
Geo::OGR::Geometry ForceToMultiPolygon (list polygons)
Geo::OGR::Geometry ForceToCollection (list geometries)
Geo::OGR::Geometry Buffer (scalar distance, scalar quadsecs=30)
Geo::OGR::Geometry Intersection (scalar other)
Geo::OGR::Geometry Union (scalar other)
Geo::OGR::Geometry UnionCascaded ()
Geo::OGR::Geometry Difference (scalar other)
Geo::OGR::Geometry SymDifference (scalar other)
Geo::OGR::Geometry Boundary ()
scalar Distance (scalar other)
scalar Intersects (scalar other)
scalar Equals (scalar other)
scalar Disjoint (scalar other)
scalar Touches (scalar other)
scalar Crosses (scalar other)
scalar Within (scalar other)
scalar Contains (scalar other)
scalar Overlaps (scalar other)
 Segmentize (scalar MaxLength)
Geo::OGR::Geometry Simplify (scalar Tolerance)
 TransformTo (scalar srs)
 Transform (scalar trans)
Geo::OSR::SpatialReference GetSpatialReference ()
 AssignSpatialReference (scalar srs)
 CloseRings ()
list GetEnvelope ()
list GetEnvelope3D ()
Geo::OGR::Geometry Centroid ()
scalar WkbSize ()
scalar GetGeometryType ()
scalar GetGeometryName ()

Public Attributes

list GEOMETRY_TYPES
list BYTE_ORDER_TYPES

Detailed Description

Note:
Most spatial analysis methods require GEOS to work rigorously.

Member Function Documentation

Add a copy of another geometry to a geometry collection

Parameters:
othera Geo::OGR::Geometry object
Parameters:
othera Geo::OGR::Geometry object
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.
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
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
Note:
a.k.a. GetArea
Returns:
the area of the polygon or multipolygon
scalar Geo::OGR::Geometry::AsBinary ( scalar  byte_order = 'XDR')

This geometric object as a Well-known binary string.

Note:
a.k.a. ExportToWkb
Parameters:
byte_orderXDR or NDR
Returns:
a WKB binary string

This geometric object as a GML string.

Note:
a.k.a. ExportToGML
Returns:
a GML string

This geometric object as a JSON string.

Note:
a.k.a. ExportToJson
Returns:
JSON string

This geometric object as a KML string.

Note:
a.k.a. ExportToKML
Returns:
KML string
Parameters:
srsa Geo::OSR::SpatialReference object

This geometric object in Well Known Text.

Note:
a.k.a. ExportToWkt
Returns:
a WKT string
Note:
a.k.a. GetBoundary
Returns:
the boundary of this geometry as a geometry
Since:
1.8.0
Geo::OGR::Geometry Geo::OGR::Geometry::Buffer ( scalar  distance,
scalar  quadsecs = 30 
)
Parameters:
distance
quadsecs
Returns:
a new Geo::OGR::Geometry object
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)
Returns:
a new Geo::OGR::Geometry object
Since:
1.8.0
Returns:
a new Geo::OGR::Geometry object

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.
scalar Geo::OGR::Geometry::Contains ( scalar  other)
Parameters:
othera Geo::OGR::Geometry object
Returns:
true if this geometry contains the other geometry, false otherwise
Returns:
a new Geo::OGR::Geometry object
scalar Geo::OGR::Geometry::CoordinateDimension ( scalar  dimension)
Parameters:
dimension[optional]
Returns:
2 or 3
Parameters:
typeOne of geometry type strings: 'Point', 'LineString', etc.

Usage:

$g = Geo::OGR::Geometry->create(...arguments...);
Returns:
a new Geo::OGR::Geometry object
Parameters:
%paramsA named parameter, one of: GeometryType, WKT, WKB, HEXWKB, HEXEWKB (PostGIS extended WKB), GML, GeoJSON, arc, and/or Points.
  • Points An anonymous array as in method Geo::OGR::Geometry::Points; Note: requires also GeometryType parameter
  • arc An anonymous list of [CenterX, CenterY, CenterZ, PrimaryRadius, SecondaryRadius, Rotation, StartAngle, EndAngle, MaxAngleStepSizeDegrees]
Note:
uses CreateGeometryFrom* functions from Geo::OGR

Usage:

$g = Geo::OGR::Geometry->create(...arguments...);
Returns:
a new Geo::OGR::Geometry object
scalar Geo::OGR::Geometry::Crosses ( scalar  other)
Parameters:
othera Geo::OGR::Geometry object
Returns:
true if this geometry crosses the other geometry, false otherwise
Parameters:
othera Geo::OGR::Geometry object
Returns:
a new Geo::OGR::Geometry object
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

Dissolve a geometrycollection into separate geometries.

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

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

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

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.

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.

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.

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.

Attempt to create a polygon from the geometry.

Exceptions:
Nonereported. If this method fails, just a copy is returned.
Returns:
a new Geo::OGR::Geometry object
Returns:
the geometry type
Returns:
an integer
Returns:
0, 1, or 2
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)
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
Returns:
an integer
Deprecated:
use string names
Returns:
a string
scalar Geo::OGR::Geometry::GetGeometryRef ( scalar  index)
Parameters:
index
Returns:
a new Geo::OGR::Geometry object whose data is a part of the parent geometry
Deprecated:
use Geo::OGR::Geometry::GeometryType, which returns the type as a string
Returns:
type as an integer
list Geo::OGR::Geometry::GetPoint ( scalar  index = 0)
Parameters:
index
Returns:
(x,y) or a list with more coordinates
scalar Geo::OGR::Geometry::GetPoint_2D ( scalar  index = 0)
Parameters:
index
Returns:
(x,y) or a list with more coordinates
scalar Geo::OGR::Geometry::GetPoint_3D ( scalar  index = 0)
Parameters:
index
Returns:
(x,y) or a list with more coordinates
Returns:
an integer
Returns:
a new Geo::OSR::SpatialReference object
scalar Geo::OGR::Geometry::GetX ( scalar  index = 0)
Parameters:
index
Returns:
a number
scalar Geo::OGR::Geometry::GetY ( scalar  index = 0)
Parameters:
index
Returns:
a number
scalar Geo::OGR::Geometry::GetZ ( scalar  index = 0)
Parameters:
index
Returns:
a number
Parameters:
othera Geo::OGR::Geometry object
Returns:
a new Geo::OGR::Geometry object
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

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

Returns:
boolean

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

Returns:
boolean

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

Returns:
boolean

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

Returns:
boolean
Returns:
the length of the linestring
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]
Geo::OGR::Geometry Geo::OGR::Geometry::new ( scalar  type = scalar Geo::OGR::wkbUnknown,
scalar  WKT = undef,
scalar  WKB = undef,
scalar  GML = undef 
)
Deprecated:
use Geo::OGR::Geometry::create, which accepts type as a string
Parameters:
typeone of Geo::OGR::wkb*
WKT
WKB
GML
Returns:
a new Geo::OGR::Geometry object
scalar Geo::OGR::Geometry::Overlaps ( scalar  other)
Parameters:
othera Geo::OGR::Geometry object
Returns:
true if this geometry overlaps the other geometry, false otherwise
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:
listref Geo::OGR::Geometry::Points ( listref  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.
Geo::OGR::Geometry::Segmentize ( scalar  MaxLength)

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

Parameters:
MaxLengththe given length
Parameters:
dimension
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]
Geo::OGR::Geometry::SetPoint_2D ( scalar  index,
scalar  x,
scalar  y 
)
Parameters:
index
x
y
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

Simplify the geometry.

Parameters:
Tolerancethe length tolerance for the simplification
Since:
1.8.0
Returns:
a new Geo::OSR::Geometry object

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
scalar Geo::OGR::Geometry::Touches ( scalar  other)
Parameters:
othera Geo::OGR::Geometry object
Returns:
true if this geometry touches the other geometry, false otherwise
Geo::OGR::Geometry::Transform ( scalar  trans)
Parameters:
transa Geo::OSR::CoordinateTransformation object
Parameters:
srsa Geo::OSR::SpatialReference object
Parameters:
othera Geo::OGR::Geometry object
Returns:
a new Geo::OGR::Geometry object
Returns:
a new Geo::OGR::Geometry object
Since:
1.8.0
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
Returns:
an integer

Member Data Documentation

Byte order strings, one of: XDR NDR

Geometry types supported by GDAL, one of: Unknown Point LineString Polygon MultiPoint MultiLineString MultiPolygon GeometryCollection None LinearRingPoint25D LineString25D Polygon25D MultiPoint25D MultiLineString25D MultiPolygon25D GeometryCollection25D


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