Skip to content

Commit

Permalink
for #1302
Browse files Browse the repository at this point in the history
  • Loading branch information
rhijmans committed Oct 6, 2023
1 parent 10deb1a commit a9c1fa9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/spatRaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,18 @@ SpatRaster SpatRaster::geometry(long nlyrs, bool properties, bool time, bool uni
s.hasUnit = true;
s.unit = getUnit();
}
if (nsrc() == 1) {
s.source_name = source[0].source_name;
s.source_name_long = source[0].source_name_long;

std::vector<std::string> un = getSourceNames();
std::sort(un.begin(), un.end() );
un.erase(std::unique(un.begin(), un.end()), un.end());
if (un.size() == 1) {
s.source_name = un[0];
}
un = getLongSourceNames();
std::sort(un.begin(), un.end() );
un.erase(std::unique(un.begin(), un.end()), un.end());
if (un.size() == 1) {
s.source_name_long = un[0];
}
} else {
for (size_t i=0; i < s.nlyr; i++) {
Expand Down

0 comments on commit a9c1fa9

Please sign in to comment.