Geo::Geos::WKBReader - Reads a Geometry from Well-Known Binary format.
use Geo::Geos::GeometryFactory; use Geo::Geos::PrecisionModel qw/TYPE_FLOATING/; use Geo::Geos::WKBReader; 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; my $w = Geo::Geos::WKBWriter->new($dimensions, TYPE_BYTEORDER_BE, $include_SRID); my $s1 = $w->write($p); my $s2 = $w->writeHEX($p); Geo::Geos::WKBReader::read($s1, $gf); # => isa 'Geo::Geos::Geometry' Geo::Geos::WKBReader::read($s1, $gf); # => isa 'Geo::Geos::Point' Geo::Geos::WKBReader::readHEX($s2, $gf); # => isa 'Geo::Geos::Geometry' Geo::Geos::WKBReader::readHEX($s2, $gf); # => isa 'Geo::Geos::Point' my $g = Geo::Geos::WKBReader::readHEX($s2, $gf); $g->compareTo($p); # => 0
GEOS C++ Library
geos::io::WKBReader
Geo::Geos
Geo::Geos::Geometry
Geo::Geos::WKBConstants
Geo::Geos::WKBWriter
Ivan Baidakou <i.baydakov@crazypanda.ru>, Crazy Panda, CP Decision LTD
You may distribute this code under the same terms as Perl itself.
To install Geo::Geos, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Geo::Geos
CPAN shell
perl -MCPAN -e shell install Geo::Geos
For more information on module installation, please visit the detailed CPAN module installation guide.