単純なシェープファイルからレイヤーをロードしてプロットしようとしています。それは米国の州の境界です。私はそれをうまくロードすることができます:
> library("sp","rgdal")
> shape = readOGR("/home/username/data/share/mapnik/world_boundaries/states_EPSG4326.shp", layer="states_EPSG4326")
OGR data source with driver: ESRI Shapefile
Source: "/home/username/data/share/mapnik/world_boundaries/states_EPSG4326.shp", layer: "states_EPSG4326"
with 2895 features and 9 fields
Feature type: wkbPolygon with 2 dimensions
しかし、それはプロットに失敗します:
> plot(shape)
There were 50 or more warnings (use warnings() to see the first 50)
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: Path drawing not available for this device
2: Path drawing not available for this device
3: Path drawing not available for this device
...
私は何が欠けていますか?プロットウィンドウには何も表示されません。このシェープファイルには単一のレイヤーのみがあります。私はそれをqgisでプロットすることができました、それは私が代わりを見つけようとしています。Rは人気のある選択肢のようですが、私は今のところあまり運がありません。私はこの警告をグーグルで検索しましたが、有用なものは何も見つかりませんでした。
編集: これと同じ応答は、私が試したすべてのシェープファイルで受信されます。これが私が確認したシェープファイルで、同じように応答します。
http://dds.cr.usgs.gov/pub/data/nationalatlas/statep010_nt00798.tar.gz
sessionInfo()の出力は次のとおりです。
> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C
[4] LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rgdal_0.7-22 sp_1.0-2
loaded via a namespace (and not attached):
[1] grid_2.15.2 lattice_0.20-10 tools_2.15.2
また、これはgentooシステムであり、dev-lang/Rで次の使用フラグが有効になっています。
- X icu java jpeg nls openmp png readline tiff
次の使用フラグが有効になっていません(機能がコンパイルされていません)。
- -bash-completion -cairo -doc -lapack -minimal -perl -profile -static-libs -tk "
私にとって疑わしいと思われるのはcairoとtkの2つだけですが、プロットに必要ですか?
ターミナルからRを同じように実行しましたが、まったく同じ結果ではありません。
> shape = readOGR("/home/username/Downloads/state/statep010.shp", layer="statep010")
OGR data source with driver: ESRI Shapefile
Source: "/home/username/Downloads/state/statep010.shp", layer: "statep010"
with 62 features and 9 fields
Feature type: wkbPolygon with 2 dimensions
> plot(shape)
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In polypath(x = mcrds[, 1], y = mcrds[, 2], border = border, ... :
Path drawing not available for this device
2: In polypath(x = mcrds[, 1], y = mcrds[, 2], border = border, ... :
Path drawing not available for this device
3: In polypath(x = mcrds[, 1], y = mcrds[, 2], border = border, ... :
Path drawing not available for this device
...