NAME

Geo::Geos::Prep::Geometry - Geometry with optimized performance for specific geometric operations

SYNOPSIS

use Geo::Geos::Coordinate;
use Geo::Geos::GeometryFactory;
use Geo::Geos::Prep::GeometryFactory;

my $gf = Geo::Geos::GeometryFactory::create();
my $c1 = Geo::Geos::Coordinate->new(1,2);
my $c2 = Geo::Geos::Coordinate->new(5,2);
my $c3 = Geo::Geos::Coordinate->new(5,0);
my $c4 = Geo::Geos::Coordinate->new(1,0);

my $lr1 = $gf->createLinearRing([$c1, $c2, $c3, $c4, $c1], 2);
my $p1 = $gf->createPolygon($lr1);

my $cx1 = Geo::Geos::Coordinate->new(1.5,1.5);
my $cx2 = Geo::Geos::Coordinate->new(4,1.5);
my $cx3 = Geo::Geos::Coordinate->new(4,0.5);
my $cx4 = Geo::Geos::Coordinate->new(1.5,0.5);
my $lr2 = $gf->createLinearRing([$cx1, $cx2, $cx3, $cx4, $cx1], 2);

my $p2 = $gf->createPolygon($lr2);

my $pp1 = Geo::Geos::Prep::GeometryFactory::prepare($p1);
my $pp2 = Geo::Geos::Prep::GeometryFactory::prepare($p2);

my $r1 = $pp1->contains($p2);                # => success
my $r2 = $pp1->containsProperly($p2);        # => success
my $r3 = !$pp1->coveredBy($p2);              # => success
my $r4 = $pp1->covers($p2);                  # => success
my $r5 = !$pp1->crosses($p2);                # => success
my $r6 = !$pp1->disjoint($p2);               # => success
my $r7 = $pp1->intersects($p2);              # => success
my $r8 = !$pp1->overlaps($p2);               # => success
my $r9 = !$pp1->touches($p2);                # => success
my $r0 = !$pp1->within($p2);                 # => success

$pp1->toString;     # => like qr/POLYGON/

SEE ALSO (C++ classes docs)

GEOS C++ Library

geos::geom::prep::PreparedGeometry

geos::geom::prep::BasicPreparedGeometry

SEE ALSO

Geo::Geos

Geo::Geos::Geometry

Geo::Geos::Prep::GeometryFactory

AUTHOR

Ivan Baidakou <i.baydakov@crazypanda.ru>, Crazy Panda, CP Decision LTD

LICENSE

You may distribute this code under the same terms as Perl itself.