Closed raymondben closed 5 years ago
Yep I think it is a case where SOauto_crop has some safeguards inside so it only works on spatial polygons
I just had a look to remind myself, 48.1 and 58.4.2 have different objects as the center of their respective polygons means you cant read the labels
a <- SOauto_map(c(0, 100), c(-70, -60))
SOmanagement(CCAMLR = T, CCAMLRlab =T, basemap = a)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘coordinates’ for signature ‘"try-error"’
Weirdly it still puts the labels in the right spots and doesn't plot the other labels from the areas not there.
I'm guessing that if the feature lies outside of the SOauto_map domain, then the autocrop fails (its operations are wrapped in tryCatch
blocks, and one of them is failing and returning the try-error object). This error object is then being stored in the reprojected SOmanagement object, and getting passed to the plot function (which is calling coordinates
). So, basically, don't return try-error objects. And if the auto reproj fails, then we need to remove that component from the SOmanagement object.
In some cases autocrop is going to make a component empty, which may cause things to go pear-shaped (e.g. CCAMLR labels have special code for areas 48.1 and 58.4.2 for reasons I don't understand, and if the SOauto_map extent doesn't include these areas, what happens?)