}
}
$icon = urlto($icon, $dest, 1);
+ $icon =~ s!/*$!!; # hack - urlto shouldn't be appending a slash in the first place
$tag = '' unless $tag;
register_rendered_files($map, $page, $dest);
$pagestate{$page}{'osm'}{$map}{'waypoints'}{$name} = {
foreach my $map (keys %waypoints) {
my $output;
my $writer = XML::Writer->new( OUTPUT => \$output,
- DATA_MODE => 1, ENCODING => 'UTF-8');
+ DATA_MODE => 1, DATA_INDENT => ' ', ENCODING => 'UTF-8');
$writer->xmlDecl();
$writer->startTag("kml", "xmlns" => "http://www.opengis.net/kml/2.2");
$writer->startTag("Document");
# first pass: get the icons
+ my %tags_map = (); # keep track of tags seen
foreach my $name (keys %{$waypoints{$map}}) {
my %options = %{$waypoints{$map}{$name}};
- $writer->startTag("Style", id => $options{tag});
- $writer->startTag("IconStyle");
- $writer->startTag("Icon");
- $writer->startTag("href");
- $writer->characters($options{icon});
- $writer->endTag();
- $writer->endTag();
- $writer->endTag();
- $writer->endTag();
+ if (!$tags_map{$options{tag}}) {
+ debug("found new style " . $options{tag});
+ $tags_map{$options{tag}} = ();
+ $writer->startTag("Style", id => $options{tag});
+ $writer->startTag("IconStyle");
+ $writer->startTag("Icon");
+ $writer->startTag("href");
+ $writer->characters($options{icon});
+ $writer->endTag();
+ $writer->endTag();
+ $writer->endTag();
+ $writer->endTag();
+ }
+ $tags_map{$options{tag}}{$name} = \%options;
}
foreach my $name (keys %{$waypoints{$map}}) {