[R] an error message in getNOAA.bathy function

Rasmus Liland jr@| @end|ng |rom po@teo@no
Tue Aug 18 18:01:35 CEST 2020


On 2020-08-18 16:36 +0200, Rasmus Liland wrote:
> On 2020-08-18 22:59 +0900, Joon-Taek Yoo wrote:
> | Dear Helpers,
> | I am trying to draw a map of East Asia 
> | using the getNOAA.bathy () 
> | function(package marmap) in R. I'v got 
> | a following error message.
> | 
> | > dat <- getNOAA.bathy(110, 160, 20, 60, res=4, keep=T)
> | Querying NOAA database ...
> | This may take seconds to minutes, depending on grid size
> | Error in .local(.Object, ...) :
> |   schannel: next InitializeSecurityContext failed: SEC_E_ILLEGAL_MESSAGE
> | (0x80090326) - This error usually occurs when a fatal SSL/TLS alert is
> | received (e.g. handshake failed).
> | 
> | I appreciate any hint. Please could 
> | you help me.
> 
> Dear Joon-Taek,
> 
> perhaps «turning off» SSL helps, by 
> setting these options:
> 
> 	options("ssl_verifyhost"=0, "ssl_verifypeer"=0)
> 
> I get another error (with SSL turned 
> on):
> 
> 	> dat <- marmap::getNOAA.bathy(110, 160, 20, 60, res=4, keep=T)
> 	Registered S3 methods overwritten by 'adehabitatMA':
> 	  method                       from
> 	  print.SpatialPixelsDataFrame sp
> 	  print.SpatialPixels          sp
> 	Querying NOAA database ...
> 	This may take seconds to minutes, depending on grid size
> 	Error in if (ncol(x) == 3 & !exists("bathy", inherits = FALSE)) { :
> 	  argument is of length zero
> 
> How do I even know what x is there, or 
> if "bathy" exists ...

Also, check out my old email from back 
in March[1] about mapping the Gulf 
Cooperation Council countries using 
ggplot.  You need the packages rgeos, 
rnaturalearth, sf; which needs the 
backend programs udunits[2], gdal[3], 
perhaps others.

Here is an example map of a wider region 
of East-Asia also showing Laos.

	world <- rnaturalearth::ne_countries(
	  scale = "medium",
	  returnclass = "sf")
	grp1 <- c("China", "Japan", "Korea", 
	  "Dem. Rep. Korea", "Taiwan", "Mongolia",
	  "Hong Kong", "Macao", "Russia")
	world$EA <- rep(NA, length(world$name))
	idx <- world$name %in% grp1
	world$GCC[idx] <- world$name[idx]
	world$CountryGroup <- 
	  rep(NA, length(world$name))
	world$CountryGroup[world$name
	  %in% grp1] <- "East-Asia"
	world <- 
	  cbind(world, 
	    sf::st_coordinates(
	      sf::st_centroid(world$geometry)))
	world$name[idx]
	
	# file <- "/tmp/ea.pdf"
	# res <- 1.2
	# width <- 7*res
	# height <- 5*res
	# pdf(file=file, width=width, height=height)
	
	file <- "/tmp/ea.png"
	res <- 100
	width <- 500
	height <- 500
	png(file=file, width=width,
	    height=height, res=res)
	
	ggplot2::ggplot(data = world) +
	  ggplot2::theme_bw() +
	  ggplot2::geom_sf() +
	  ggplot2::geom_sf(
	    fill = NA, color = gray(.5)) +
	  ggplot2::geom_sf(ggplot2::aes(
	    fill=CountryGroup)) +
	  ggrepel::geom_text_repel(
	    mapping=ggplot2::aes(
	      x=X, y=Y, label=GCC),
	    color="blue") +
	ggplot2::coord_sf(
	  xlim = c(100, 160),
	  ylim = c(10, 60),
	  expand = FALSE) +
	ggplot2::xlab("Longitude") +
	ggplot2::ylab("Latitude") +
	  ggplot2::ggtitle("East-Asia")
	
	dev.off()

Best,
Rasmus

[1] https://stat.ethz.ch/pipermail/r-help/2020-March/466155.html
[2] http://www.unidata.ucar.edu/software/udunits/
[3] http://www.gdal.org/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ea.png
Type: image/png
Size: 52931 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200818/b5a1bec1/attachment.png>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200818/b5a1bec1/attachment.sig>


More information about the R-help mailing list