The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Geo::Geos::WKBWriter - Writes a Geometry into Well-Known Binary format.

SYNOPSIS

use Geo::Geos::GeometryFactory;
use Geo::Geos::PrecisionModel qw/TYPE_FLOATING/;
use Geo::Geos::WKBWriter;
use Geo::Geos::WKBConstants qw/TYPE_BYTEORDER_BE/;

my $pm = Geo::Geos::PrecisionModel->new(TYPE_FLOATING);
my $gf = Geo::Geos::GeometryFactory::create($pm, 3857);
my $c  = Geo::Geos::Coordinate->new(1,2);
my $p  = $gf->createPoint($c);

my $dimensions   = 2;
my $include_SRID = 1;

Geo::Geos::WKBWriter->new($dimensions, TYPE_BYTEORDER_BE, $include_SRID);    # => isa 'Geo::Geos::WKBWriter'
Geo::Geos::WKBWriter->new($dimensions, TYPE_BYTEORDER_BE);                   # => isa 'Geo::Geos::WKBWriter'
Geo::Geos::WKBWriter->new($dimensions);                                      # => isa 'Geo::Geos::WKBWriter'
Geo::Geos::WKBWriter->new();                                                 # => isa 'Geo::Geos::WKBWriter'

my $w = Geo::Geos::WKBWriter->new($dimensions, TYPE_BYTEORDER_BE, $include_SRID);

$w->setOutputDimension(2);
$w->getOutputDimension;     # => 2

$w->setByteOrder(TYPE_BYTEORDER_BE);
$w->getByteOrder;                       # => TYPE_BYTEORDER_BE

$w->setIncludeSRID(1);
$w->getIncludeSRID;     # => success

$w->write($p);
$w->writeHEX($p);

SEE ALSO (C++ classes docs)

GEOS C++ Library

geos::io::WKBWriter

Geo::Geos

Geo::Geos::Geometry

Geo::Geos::WKBConstants

Geo::Geos::WKBReader

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.