gmt2kml style names not unique when building overlays
|Target version:||Candidate for next bugfix release|
gmt2kml uses simple running numbers to create style ID tags, i.e., st0, st1, ... But when another gmt2kml layer is produced the numbering repeats, resulting in duplicate style definitions in the combined KML file. The solution might be to either pass the previous highest ID number via gmt.history or use more unique style names that combines a running number, the color and pen width and other attributes as part of the style name, e.g.
That should prevent styles with different settings from getting the same tag.
Generate style ID based on process ID in gmt2kml to ensure uniqueness, see issue #509
#1 Updated by Joaquim almost 4 years ago
We could use time as ID. Say, number of seconds from beginning of year plus the running number. It would get something like:
But a potential problem raises if in an script the first layer is so fast to write that next layer would get the same "thisRunStartTime"
#4 Updated by Remko almost 4 years ago
I don't think your eventual solution, adding n_colors to PID is a good solution, because the different layers can have different n_colors values, which will allow n_colors+PID to overlap again. Best is to add something to the name of the ID such that no clash with the colours can occur. So styles should be called "st<pid>" where <pid> is the process ID. (You can add some letters to the colour ID as well, if your care, but is not necessary).