Skip to content

Commit

Permalink
cluster to shapefile grouped: Add comment to metadata
Browse files Browse the repository at this point in the history
Also use a better method to remove unwanted metadata items.

Updates #757
  • Loading branch information
shawnlaffan committed Nov 17, 2021
1 parent 2bf2d78 commit 622e64b
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions lib/Biodiverse/Cluster.pm
Original file line number Diff line number Diff line change
Expand Up @@ -544,16 +544,34 @@ sub export_shapefile {
sub get_metadata_export_shapefile_grouped {
my $self = shift;

my $comment_text = <<'END_COMMENT_TEXT'
Note that list values can be attached to the shapefile
in a GIS, spreadsheet or data analysis system using
a database join after also exporting grouped
values to text ("Table grouped" option).
END_COMMENT_TEXT
;

my $metadata = $self->get_metadata_export_shapefile;
$metadata->{format} = 'Shapefile grouped';
push @{$metadata->{parameters}},
$self->get_grouped_export_metadata;
splice @{$metadata->{parameters}}, 1, 1; # dirty hack
$self->get_grouped_export_metadata,
{
name => 'shape_grouped_export_comment',
type => 'comment',
label_text => $comment_text,
};

for (@{$metadata->{parameters}}) {
bless $_, $parameter_metadata_class;
}

# hack - remove some we don't want
my @arr = grep {$_->get_name ne "shape_export_comment"}
grep {$_->get_name ne 'list'}
@{$metadata->{parameters}};
$metadata->{parameters} = \@arr;

return wantarray ? %$metadata : $metadata;
}

Expand Down

0 comments on commit 622e64b

Please sign in to comment.