Skip to content

Commit 484686c

Browse files
authored
String parsing in DCW header polygons needed to account for -Ph. (#1892)
1 parent f3f6950 commit 484686c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/gmt_main.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,14 +691,14 @@ function get_dataset(API::Ptr{Nothing}, object::Ptr{Nothing})::GDtype
691691
Darr[seg_out].header = hdrstr
692692
else
693693
if (DCWnames && (ind = findfirst(" -Z", hdrstr)) !== nothing)
694-
Darr[seg_out].attrib["CODE"] = hdrstr[4+codelen-2:4+codelen-1]
694+
Darr[seg_out].attrib["CODE"] = hdrstr[ind[end]+1+codelen-2:ind[end]+1+codelen-1]
695695
if ((ind_par = findfirst(" (", hdrstr)) !== nothing)
696696
# The nextind() is because Brasil states have unicode names and then all get fucked with regular ranges.
697-
Darr[seg_out].attrib["NAME"] = hdrstr[7+codelen-2:nextind(hdrstr, ind_par[1]-2)]
697+
Darr[seg_out].attrib["NAME"] = hdrstr[ind[end]+codelen+2:nextind(hdrstr, ind_par[1]-2)]
698698
att_name = (codelen == 2) ? "CONTINENT" : "COUNTRY"
699699
Darr[seg_out].attrib[att_name] = (codelen == 2) ? hdrstr[ind_par[2]+1:ind_par[2]+2] : hdrstr[ind[3]+1:ind[3]+2]
700700
else
701-
Darr[seg_out].attrib["NAME"] = hdrstr[7+codelen-2:end]
701+
Darr[seg_out].attrib["NAME"] = hdrstr[7+codelen-2:end] # This can't be right and should not happen. DCW has -Z
702702
end
703703
end
704704
end

0 commit comments

Comments
 (0)