NAME
Geo::Shapefile::Writer - simple pureperl shapefile writer
VERSION
version 0.006
SYNOPSIS
my $shp_writer = Geo::Shapefile::Writer->new( 'summits', 'POINT',
[ name => 'C', 100 ],
[ elevation => 'N', 8, 0 ],
);
$shp_writer->add_shape( [86.925278, 27.988056], 'Everest', 8848 );
$shp_writer->add_shape( [42.436944, 43.353056], { name => 'Elbrus', elevation => 5642 } );
$shp_writer->finalize();
DESCRIPTION
Geo::Shapelib is cool, but not portable.
So here is an alternative, if you need just simple shp export.
METHODS
new
my $shp_writer = Geo::Shapefile::Writer->new( $name, $type, @attr_descriptions );
Create object and 3 associated files.
Possible types: POINT, POLYLINE, POLYGON (more to be implemented).
Possible attribute description formats:
* scalar - just field name
* arrayref - [ $name, $type, $length, $decimals ]
* hashref - { name => $name, type => 'N', length => 8, decimals => 0 } - CAM::DBF-compatible
Default C(64) will be used if field is not completely described
add_shape
$shp_writer->add_shape( $shape, @attributes );
$shape depends on file type:
* point: [$x,$y]
* polyline or polygon: [ [[$x0,$y0], ...], \@part2, ... ]
Attributes are array or arrayref: [$val1, $val2, ...] or hashref: { $name1 => $val1, ...}
finalize
$shp_writer->finalize();
Update global fields, close files
AUTHOR
liosha <liosha@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by liosha.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.