首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在tempdir()中打开GitHub格式文件

无法在tempdir()中打开GitHub格式文件
EN

Stack Overflow用户
提问于 2021-05-13 19:39:48
回答 1查看 33关注 0票数 0

我想通过*zip下载打开一个GitHub格式的shapefile,但在windows 10中没有成功。

代码语言:javascript
复制
library(rgdal)

# get AOI
download.file(
  "https://github.com/Leprechault/trash/blob/main/stands_example.zip",
  zip_path <- tempfile(fileext = ".zip")
)
unzip(zip_path, exdir = tempdir())

Warning message:
In unzip(zip_path, exdir = tempdir()) :
  error 1 extracting from zip file

setwd(tempdir())
stands_extent <- readOGR(file.path(tempdir(), "stands_target")) # Border
Error in ogrListLayers(dsn = dsn) : Cannot open data source

dir()
[1] "file9e88423c5c2b.zip"                             "rs-graphics-5776e6df-be67-40c4-a4f7-e311eb11d978"

拜托,这个问题有什么帮助吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-13 19:53:14

代码语言:javascript
复制
library(rgdal)

# get AOI
download.file(
  "https://github.com/Leprechault/trash/raw/main/stands_example.zip",
  zip_path <- tempfile(fileext = ".zip")
)
unzip(zip_path, exdir = tempdir())
setwd(tempdir())
stands_extent <- readOGR(".", "stands_target") 
OGR data source with driver: ESRI Shapefile 
Source: "C:\Users\fores\AppData\Local\Temp\RtmpGSHaOM", layer: "stands_target"
with 7 features
It has 2 fields
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67525246

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档