法国国家研究所 (Insee) 提供 MapInfo 格式的地理数据(两个文件 .mid 和 .mif 以及一个 dbf 文件)。如何在 R 中读取这些文件?
这是一个 example .
最佳答案
MapInfo 文件有一个 OGR 驱动程序(包 rgdal
):
R> library("rgdal")
R> ogrDrivers()[28, ]
name write
28 MapInfo File TRUE
但是你的文件/几何有问题,
readOGR
给出错误信息:R> ogrListLayers("R02_rfl09_UTM20N1000.mid")
[1] "R02_rfl09_UTM20N1000"
R> readOGR("R02_rfl09_UTM20N1000.mid", layer="R02_rfl09_UTM20N1000")
OGR data source with driver: MapInfo File
Source: "R02_rfl09_UTM20N1000.mid", layer: "R02_rfl09_UTM20N1000"
with 967 features and 4 fields
Feature type: wkbPolygon with 2 dimensions
Error in stopifnot(is.list(srl)) : ring not closed
但是,我能够使用 GRASS GIS 读取文件。 ,可以从 R 编写脚本(包
spgrass6
):v.in.ogr dsn=R02_rfl09_UTM20N1000.mid output=R02_rfl09_UTM20N1000 snap=1e-08
关于r - 如何读取 R 中的 Mapinfo 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20101083/