Closed dankelley closed 7 years ago
I second this -- in fact, I was just running into a similar issue today trying to plot a partial coastline that I digitized myself (by clicking on a map). It worked, but gave me an error about trying to fill it.
BTW, hello from Barrow Strait! :ship:
Can you quote the error here, so I'll be sure to fix that? (The code is a bit rats-nesty.) Hello from Hfx; sorry, no cute smiley.
PS. I submitted gsw, and it went through CRAN cleanly.
Not an error, just a warning. Though I was confused because I deliberately tried selecting points that would make a closed polygon:
Warning message:
In plot,coastlinemethod() : setting col=NULL because the coastline is not fillable
I can get around it by specifying col=NULL
directly. You should be able to reproduce it with this:
library(oce)
gcl <- new("coastline"
, metadata = structure(list(units = list(), flags = list(), filename = "",
fillable = FALSE), .Names = c("units", "flags", "filename",
"fillable"))
, data = structure(list(longitude = c(-91.1976773663425, -91.2053381650185,
-91.2042235829977, -91.2024715003759, -91.1967178164649, -91.1905088294177,
-91.1822956420286, -91.1726008879287, -91.1659943597529, -91.1599595819168,
-91.1544483628089, -91.1489306709048, -91.1449243376391, -91.1375383327563,
-91.1317294980736, -91.1259262026332, -91.1185882665898, -91.1138256128809,
-91.1095561138909, -91.1053838666637, -91.1042398475035, -91.1063617689029,
-91.108936387965, -91.1172823481728, -91.1263763259137, -91.1334457936465,
-91.1445595428857, -91.1547851574737, -91.1630464202874, -91.1722763425263,
-91.1810187301036, -91.1873296315148, -91.197993989946, -91.2082379173004,
-91.2169748669161, -91.2266999066135, -91.2344644300887, -91.2422927143881,
-91.250636641793, -91.2584830471254, -91.2653289388304, -91.2731659009464,
-91.2780294545966, -91.2868223734106, -91.2926611284233, -91.2960599458824,
-91.2999945684562, -91.2991321391764, -91.2977951867918, -91.2940711378265,
-91.2922969328989, -91.2915001504461, -91.2902244079237, -91.2903920425223,
-91.2905241961789, -91.2905673604703, -91.2911587491735, -91.2902832077799,
-91.2914383396754, -91.2926859344112, -91.2933807195823, -91.2962375944188,
-91.2994369700048, -91.3016537465522, -91.3048457361491, -91.3080484529339,
-91.3118196526634, -91.3134352929187, -91.3147143379713, -91.3154846441834,
-91.3163403740522, -91.3167549238857, -91.3167165649662, -91.3162320814711,
-91.3156383743139, -91.3149079157392, -91.3141787820598, -91.3132727583296,
-91.3121680447836, -91.3108509723452, -91.309445651953, -91.308563131977,
-91.3080254303772, -91.308052927187, -91.308352018271, -91.3079270402821,
-91.3076664684416, -91.3081342888112, -91.308653082704, -91.308970589442,
-91.3087828470948, -91.30803020267, -91.30698229238, -91.3059249184531,
-91.304812522998, -91.3039583096642, -91.303436658076, -91.3033359837264,
-91.3036491579556, -91.3032390681559, -91.3030025743503, -91.3039163251862,
-91.304168904724, -91.3035622749689, -91.3025924592165, -91.3013654742393,
-91.299574011951, -91.298400568823, -91.2961202128576, -91.2945851356858,
-91.2932855589683, -91.2907546169841, -91.2879345094298, -91.2855743527175,
-91.2839231703745, -91.2813879059483, -91.2785042999037, -91.2768146893989,
-91.276109967458, -91.2755146448627, -91.2766174735774, -91.2781431714552,
-91.2792455545731, -91.2801142602809, -91.2807638429958, -91.281210307274,
-91.3219492987569, -91.3226333847895, -91.3240282439256, -91.3256995237591,
-91.3274888821391, -91.3289912358205, -91.3307632919646, -91.3330783599804,
-91.3340190567074, -91.3352400427596, -91.337273316838, -91.3379198542373,
-91.3385704201629, -91.3400191590836, -91.3411848880298, -91.3427710485014,
-91.3440349815356, -91.3447672164877, -91.3458624409033, -91.3467804237581,
-91.3476162603504, -91.3483033122674, -91.3492425025678, -91.3503433153048,
-91.3509987212812, -91.352057648035, -91.3530232178012, -91.353732995208,
-91.354316931521, -91.3543245536421, -91.3549391870113, -91.3551206270103,
-91.3551291748154, -91.3551915345908, -91.3554508637445, -91.3558508523429,
-91.3560206245631, -91.3560179152973, -91.3562826803628, -91.3560903906276,
-91.3557651979971, -91.3554061087402, -91.3553558536211, -91.3560107901031,
-91.3563793374808, -91.3570730848645, -91.3575237862614, -91.3581438732928,
-91.3591970433043, -91.3600865397733, -91.3600133194583, -91.3614498949855,
-91.36310749325, -91.3642427217231, -91.3647266998799, -91.3661599743003,
-91.3681239916016, -91.3698430692637, -91.3715777910625, -91.3724940239795,
-91.3751213412144, -91.3765458182904, -91.3786329852145, -91.3809098869917,
-91.382706267183, -91.384318806617, -91.3862585370485, -91.3881984785935,
-91.3907985283365, -91.3917726453872, -91.3973563310744, -91.1962990651612
), latitude = c(74.6955864618606, 74.6926887024595, 74.6898497134082,
74.6841711284659, 74.6805647777085, 74.6780902236197, 74.6759015699515,
74.673447375547, 74.6703247032919, 74.6658625248566, 74.6630479759945,
74.6611886803125, 74.6599983047102, 74.655625100149, 74.6529883525916,
74.6493260889628, 74.6454352818946, 74.6422070293691, 74.6397695388289,
74.6365772459171, 74.6331472238361, 74.6308611468383, 74.6281993704501,
74.626662365426, 74.6256863470995, 74.6248661455131, 74.6243147975798,
74.6236625370356, 74.6237660230352, 74.6238665411977, 74.624093020412,
74.6243239803837, 74.6245310017449, 74.6251594047919, 74.6253924839429,
74.6260872673621, 74.6259119183019, 74.6264938559299, 74.6272048959209,
74.6278051531103, 74.6280315498037, 74.6283801668281, 74.628235458787,
74.6283272167313, 74.6281780462483, 74.6280385004853, 74.6282747844017,
74.6291613303262, 74.6301778160844, 74.6317130248826, 74.6332449041948,
74.6347773096842, 74.6364441406871, 74.6378538674905, 74.6392702377395,
74.6405642765832, 74.642112169749, 74.6436662974248, 74.6449560711398,
74.6465114020678, 74.6478139570292, 74.6493854568527, 74.6509514643333,
74.6526574028731, 74.6541001308429, 74.6555470025884, 74.6573957251099,
74.6581465876625, 74.6586154315559, 74.6589855934726, 74.6592341507016,
74.6594869996528, 74.6597280824094, 74.6598108191, 74.6597162065651,
74.6595262806028, 74.6593759811681, 74.659191129303, 74.6590972067553,
74.6590160972838, 74.6589949489025, 74.6590440513162, 74.6591098753749,
74.6592858631174, 74.6594298722138, 74.6595452427864, 74.65966058311,
74.6598065721332, 74.6599036501561, 74.6601188735221, 74.6603384054858,
74.6605967472562, 74.6608594153706, 74.6611604405239, 74.6617148281166,
74.6621168801949, 74.662320874483, 74.662788663034, 74.6631105160068,
74.6634080839128, 74.6635769390963, 74.6636311769442, 74.6638003643284,
74.6638775375722, 74.664165844873, 74.6643802913534, 74.6645586166191,
74.6645611211904, 74.6645273693684, 74.6644738441796, 74.6645165086833,
74.664543493301, 74.6647454795493, 74.6650067477585, 74.6651294216294,
74.6654291419289, 74.6657772333449, 74.6662958227341, 74.6667724224722,
74.6673392540475, 74.6674240120263, 74.6670279083235, 74.6671122649174,
74.6675460398189, 74.6677630175158, 74.6682420817891, 74.6680592081836,
74.667180515473, 74.6666841564067, 74.6663160890811, 74.6657780927451,
74.6653329944873, 74.6649292420215, 74.6644720658815, 74.6641583882346,
74.6639199991031, 74.6635623849975, 74.6631738475293, 74.6628914391947,
74.6624802401789, 74.662070388656, 74.661778472569, 74.6614942427227,
74.6610964808541, 74.6608188105376, 74.6605720775147, 74.6601053438932,
74.6596709563565, 74.659161980949, 74.65863099292, 74.6580908491376,
74.6573369343008, 74.6566876878523, 74.6561638049791, 74.6553672145605,
74.6547240310978, 74.6543132807277, 74.6538157894573, 74.6533196927898,
74.6526542838033, 74.6522589297694, 74.6517816297564, 74.6513771037267,
74.6508763093436, 74.6505277275289, 74.6500702367552, 74.6497364525815,
74.6493377576799, 74.6489791608459, 74.6486799168992, 74.6483199736216,
74.647952697058, 74.6476570297847, 74.6474074442932, 74.6469446128138,
74.646408604276, 74.6460118599872, 74.6458289346577, 74.6455665929436,
74.6453590146457, 74.645153677398, 74.6450568336023, 74.6451738499637,
74.6449447863717, 74.644802941022, 74.6445829719662, 74.6447017787354,
74.6445263969064, 74.6446483633695, 74.6445906659887, 74.6447429376041,
74.6445252063858, 74.6446503128998, 74.6446929622612, 74.6448604680497,
74.6448579668943, 74.6690724007885, 74.6987025400407)), .Names = c("longitude",
"latitude"))
, processingLog = structure(list(time = structure(c(1502648213.38384, 1502648213.38384
), class = c("POSIXct", "POSIXt")), value = c("create 'coastline' object",
"as.coastline(longitude = gcl$lon, latitude = gcl$lat)")), .Names = c("time",
"value"))
)
plot(gcl)
Got it. That warning basically stems from the base-graphics business of col
meaning something different to polygon
, compared with the line- and point-plotting functions. I am of the mind that col
should mean what the user expects it to mean -- if lines
or points
will be called, it means the colour of those lines and points, but it only has this polygon
meaning if polygons are actually to be drawn. I will think about how to code and document all of this, likely tomorrow.
(My application that tipped me over the edge was drawing pictures of the data from my phone, during my run -- of course, I don't like the plots the phone/web show. I've discovered interesting patterns with these data, in terms of location errors. Most seem to be building/tree related, but today the first km was quite bad, and that's when it was misting on me. I hope scientific GPS units employ dual frequency to avoid such atmospheric errors, as apparently the military ones do.)
I feel that things are working now, in develop
commit c87f471fcaf041cf0661a2b29e2f7601dfd4c38c
There is test code at https://github.com/dankelley/oce-issues/tree/master/12xx/1282 and 1282b.R
is patterned on CR's test code.
I'm going to close this because it has (as stated in the title) been addressed. Of course, I invite other developers or users to reopen it or make a new issue with a new title, if desired.
PS. CR's actual code doesn't work for me because the initialize
call doesn't like the arguments. I assume CR used dput
on something created by as.coastline
, or by initialize
as it presently exists for coastline objects in oce. This suggests to me that there must be a convention about initialize
generic functions that I've not followed, and we could have an issue on that, if users find it problematic. (I'm inclined to focus on other things, since the initialize
methods are not even documented in oce
, so we have some freedom in them. )
PPS. The reason we don't document the initialize methods is that I've found no way to do that in Roxygen, despite hours of frustrating experiments and web searches.)
It happens quite often that I want to show locations that are not coastlines, and I'd like to use something like
in such cases. But I can't. So I end up determining the
asp
from the median-range oflat
, etc., or finding the lon and lat ranges, choosing an actual coastline, and then plotting the actual coastline with limits set by these ranges, adding the original data withpoints
ormapPoints
, as the case may be. In neither case is this method especially difficult, but it's a bit annoying.I will look into ways of altering
as.coastline
and/orplot,coastline-method
to handle such cases, and if I can see a way that will clearly not break existing functionality, I'll code it, despite my feeling that oce should be in slush mode.