NAME
Geo::OGC::Geometry - Perl extension for OGC simple feature geometries
SYNOPSIS
use Geo::OGC::Geometry;
my $point = Geo::OGC::Point->new(Text => 'POINT 1 1');
DESCRIPTION
OGC simple feature geometries is a class hierarchy for geographic information. This module conforms to the document OGC 06-103r4, which is the current document describing the standard. The document is available from http://www.opengeospatial.org/.
This module is currently mostly an interface and storage classes and does not contain implementations of most of the methods for testing spatial relations etc.
CLASSES
Geo::OGC::Geometry
Geo::OGC::Geometry is the root class and it represents an arbitrary geospatial geometry.
- new(%params)
-
Create a new Geometry object or a new object belonging to a concrete subclass of Geometry if initialization data is given.
%param is a hash containing named parameters. The keywords are (subclasses of Geometry may add new keywords):
- Text
-
A well-known text to initialize an object of a concrete class.
- SRID
-
Sets the Spatial Reference System ID of the object, default is -1.
- Precision
-
If specified, has the effect that numeric comparisons in the Equals method is is preceded with a rounding operation (using sprintf "%.pe", where p is the Precision-1, i.e the number of meaningful numbers is Precision). Affects also AsText.
- Clone()
-
Clones this object, i.e., creates a spatially exact copy.
- Precision($precision)
-
Sets or gets the precision.
Not in the specification.
- Dimension()
-
The dimension (2 or 3) of this geometric object. In non-homogeneous collections, this will return the largest topological dimension of the contained objects.
- GeometryType()
-
Returns the geometry type of this object.
- SRID($srid)
-
Get or set Spatial Reference System ID for this object.
- Envelope()
-
Compute the minimum bounding box for this geometry as a ring.
- AsText()
-
This object in Well-known Text representation.
- AsBinary()
-
This object in Well-known Binary representation.
- IsEmpty()
-
Returns true if this object is empty, i.e. contains no points.
- IsSimple()
-
Returns true if this geometric object has no anomalous geometric points, such as self intersection or self tangency.
- Is3D()
-
Returns true if this geometric object has z coordinate values.
- IsMeasured()
-
Returns true if this object has m coordinate values.
- Boundary()
-
Returns the closure of the combinatorial boundary of this object.
- Equals($geometry)
-
Returns true if this object is "spatially equal" to the other geometry.
- Disjoint($geometry)
-
Returns true if this object is "spatially disjoint" from the other geometry.
- Intersects($geometry)
-
Returns true if this object "spatially intersects" the other geometry.
- Touches($geometry)
-
Returns true if this object "spatially touches" the other geometry.
- Crosses($geometry)
-
Returns true if this object "spatially crosses" the other geometry.
- Within($geometry)
-
Returns true if this object is "spatially within" the other geometry.
- Contains($geometry)
-
Returns true if this object "spatially contains" the other geometry.
- Overlaps($geometry)
-
Returns true if this object "spatially overlaps" the other geometry.
- Relate($geometry, $intersectionPatternMatrix)
-
Returns true if this object is spatially related to the other geometry by testing for intersections between the interior, boundary and exterior of the two geometric objects as specified by the values in the intersectionPatternMatrix. This returns FALSE if all the tested intersections are empty except exterior (this) intersect exterior (another).
- LocateAlong($mValue)
-
Returns a derived geometry collection value that matches the specified m coordinate value.
- LocateBetween($mStart, $mEnd)
-
Returns a derived geometry collection value that matches the specified range of m coordinate values inclusively.
- Distance($geometry)
-
Returns the shortest distance between any two points between this object and the other geometry.
- Buffer($distance)
-
Returns a surface whose points are closer than or at the given distance from this object.
- ConvexHull()
-
Returns a convex hull of this object.
- Intersection($geometry)
-
Returns a point set intersection of this object with the other geometry.
- Union($geometry)
-
Returns a point set union of this object with the other geometry.
- Difference($geometry)
-
Returns a point set difference of this object with the other geometry.
- SymDifference($geometry)
-
Returns a point set symmetric difference of this object with the other geometry.
- MakeCollection()
-
Creates a collection which contains this geometry.
- ApplyTransformation($transformation)
-
transf = A point transformation method which will be applied for all the points in the geometry as:
($new_x, $new_y, $new_z) = $transformation->($x, $y, $z)
Not in the specification.
Geo::OGC::SpatialReferenceSystem
Geo::OGC::Point
A 0-dimensional geometric object.
- new()
-
A new point object can be created (besides using WKT) with
$point = Geo::OGC::Point->new($x, $y); $point = Geo::OGC::Point->new($x, $y, $z); $point = Geo::OGC::Point->new(point => [$x, $y]); $point = Geo::OGC::Point->new(point => [$x, $y, $z]); $point = Geo::OGC::Point->new(point => [$x, $y, $z, $m]); $point = Geo::OGC::Point->new(pointz => [$x, $y, $z]); $point = Geo::OGC::Point->new(pointz => [$x, $y, $z, $m]); $point = Geo::OGC::Point->new(pointm => [$x, $y, $m]); $point = Geo::OGC::Point->new(pointm => [$x, $y, $z, $m]); $point = Geo::OGC::Point->new(pointzm => [$x, $y, $z, $m]); $point = Geo::OGC::Point->new(X => $x, Y => $y); $point = Geo::OGC::Point->new(X => $x, Y => $y, Z => $z); $point = Geo::OGC::Point->new(X => $x, Y => $y, Z => $z, M => $m);
- Z()
-
Get or set the z coordinate.
Setting is not in the specification.
- M()
-
Get or set the measure.
Setting is not in the specification.
Geo::OGC::Curve
A 1-dimensional geometric object.
- AddPoint($point, $i)
-
Adds a point to the end (N+1) of the curve by default.
point = A Point object i [optional] = The location in the sequence (1..N+1) where to add the Point.
Not in the specification.
- DeletePoint($i)
-
Delete a point from the curve.
i = The location in the sequence (1..N) from where to delete the Point.
Not in the specification.
- NumPoints()
-
Return the number of points in the sequence.
- PointN($N, $point)
-
Get or set the point of the sequence.
N = A location in the sequence. point [optional] = A Point object, if defined sets the point to index N.
The first point has the index 1 as OGC SF SQL conformance test uses 1-based indexing.
- Close()
-
Close the curve by adding the first point also as the last point.
Not in the specification.
- IsRing($upgrade)
-
Tests whether this curve is a ring, i.e., closed and simple.
upgrade [optional, not in the specification] = Upgrades this curve into a Ring if this really could be a ring.
- Reverse()
-
Reverse the order of the points in the sequence.
Not in the specification.
Geo::OGC::LineString
- Length()
-
The length of this LineString in its associated spatial reference.
Currently computed as a simple euclidean distance.
Geo::OGC::Line
Geo::OGC::LinearRing
- IsPointIn($point)
-
Tests whether the given point is within the ring.
Uses the pnpoly algorithm from http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html.
Assumes a simple closed ring. May or may not return true if the point is on the border.
Not in the specification.
- Area()
-
Compute the area of the ring. The area is computed as a simple euclidean area.
Not in the specification.
Assumes a simple closed ring
Returns the area as a negative number if the sense of the rotation of the ring is clockwise.
Geo::OGC::Surface
A 2-dimensional geometric object.
Geo::OGC::Polygon
Geo::OGC::Triangle
Geo::OGC::PolyhedralSurface
Geo::OGC::TIN
Geo::OGC::GeometryCollection
- NumGeometries()
-
Return the number of geometries in this collection.
- GeometryN($n)
-
Return the Nth geometry from the collection (the index of the first geometry is 1).
Geo::OGC::MultiSurface
Geo::OGC::MultiCurve
Geo::OGC::MultiPoint
Geo::OGC::MultiPolygon
Geo::OGC::MultiLineString
ACKNOWLEDGEMENTS
The OpenGIS (r) Implementation Standard for Geographic information - Simple feature access - Part 1: Common architecture was heavily used in preparation of this module.
REPOSITORY
https://github.com/ajolma/Geo-OGC-Geometry
AUTHOR
Ari Jolma https://github.com/ajolma
COPYRIGHT AND LICENSE
Copyright (c) 2008- Ari Jolma
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.