NAME
XML::Generator::SVG::ShapeFile - Generate SAX2 events for an SVG rendering of an ESRI shapefile.
SYNOPSIS
use PerlIO::gzip;
use XML::SAX::Writer;
use XML::Generator::SVG::ShapeFile;
# see CAVEATS below
open SVGZ, ">:gzip", "/path/to/my/output.svgz"
|| die "do the right thing, luke";
my $writer = XML::SAX::Writer->new(Output => \*SVGZ);
my $svg = XML::Generator::SVG::ShapeFile->new(Handler=>$writer);
$svg->set_width(1024);
$svg->set_decimals(1);
$svg->set_title("You are here");
$svg->set_stylesheet("foo.css");
$svg->add_point({lat=>"123",long=>"456"});
$svg->render("/path/to/shapefile");
DESCRIPTION
Generate SAX2 events for an SVG rendering of an ESRI shapefile.
CAVEATS
Depending on your input data, this package may generate huge SVG files if left uncompressed.
DOCUMENT STRUCTURE
+ svg
+ metadata
+ rdf:Description [@rdf:about = '...']
~ dc:title
~ dc:description
~ dc:publisher
~ dc:language
- dc:date
- dc:format
+ g [@id = 'map']
- rect [@id = 'canvas']
- path (+)
~ g [@id = 'locations']
+ g [@id = '...'] (+)
- title
-circle
PACKAGE METHODS
__PACKAGE__->new(\%args)
Inherits from XML::SAX::Base, so constructor arguments are the same.
OBJECT METHODS
$obj->set_width($int)
Required
$obj->set_decimals($int)
Required
$obj->set_uri($str)
Set the URI used to identify the document in RDF metadata section.
Default is '#'
$obj->set_title($str)
Set the title for the document's RDF metadata section.
$obj->set_description($str)
Set the description for the document's RDF metadata section.
$obj->set_publisher($str)
Set the publisher for the document's RDF metadata section.
$obj->set_language($str)
Set the language for the document's RDF metadata section.
$obj->set_stylesheet($str)
Set the URI for the document's CSS stylesheet.
$obj->add_point(\%args)
Points are added as SVG circle elements.
Valid arguments are :
lat
The latitude, in decimal form, of the point you are adding.
Required
long
The longitude, in decimal form, of the point you are adding.
Required
id
Default is 'id-<lat>-<long>', where decimal points are replaced by '-'
title
A label for the point you are adding.
radius
The radius of the point you are adding.
Default is '1'
style
CSS stylings specific to the point you are adding.
$obj->render($path)
Generate SAX2/SVG events for an ESRI shapefile.
VERSION
0.2
DATE
$Date: 2004/08/21 04:13:28 $
AUTHOR
Aaron Straup Cope <ascope@cpan.org>
SEE ALSO
http://www.webmapper.net/svg/create/
(these are the nice people who did most of the hard work for this package)
LICENSE
Copyright (c) 2004 Aaron Straup Cope. All rights reserved.
This is free software, you may use it and distribute it under the same terms as Perl itself.