2017-08-09 10 views
1

MacBookにgdalをインストールしてしまった。これまでのコードでは、RのH4ファイル(.hdf)を開いて操作するようになっていました。同じコードがデスクトップ上で動作します。しかし、現時点では、このコードはデスクトップ上で動作し、ノートパソコンでは動作しません。同じコード。同じデータ。GDALをOSX/MAC上でバインドする - R4でファイルを開く/探索できないR

これは、gdalからcondaまでpythonサポートをインストールしようとしていると思われます。

これで、hashfのhdfファイルにBashのコマンドラインでgdalinfoを実行すると、ファイルが正常に読み込まれます。しかし、私はRでこのコードを実行する場合 - )(GDALutils関数get_subdatasetsを使用して:

get_subdatasets("MOD09GA.A2016199.h09v05.006.2016201065406.hdf")

それはエラーを返します:

別のパッケージを使用して、同様
ERROR 4: `data/week6/modis/reflectance/17_july_2016/MOD09GA.A2016199.h09v05.006.2016201065406.hdf' not recognised as a supported file format. 

gdalinfo failed - unable to open 'data/week6/modis/reflectance/17_july_2016/MOD09GA.A2016199.h09v05.006.2016201065406.hdf'. 
Error in split1[[1]] : subscript out of bounds 
In addition: Warning message: 
running command '"/usr/local/Cellar/gdal/1.11.5_3/bin/gdalinfo" "data/week6/modis/reflectance/17_july_2016/MOD09GA.A2016199.h09v05.006.2016201065406.hdf"' had status 1 

`` `

- rgdal私は関数を実行します。gdalinfo()

Warning message: running command '"/usr/local/Cellar/gdal/1.11.5_3/bin/gdalinfo" "data/week6/modis/reflectance/17_july_2016/MOD09GA.A2016199.h09v05.006.2016201065406.hdf"' had status 1

私は、これら2つの異なるパッケージや関連機能です実現。

私はこの記事を見つけました:

が、コードgdal_chooseInstallation(hasDrivers=c("HDF4","HDF5"))

戻り

Error in gdal_chooseInstallation(hasDrivers = c("HDF4", "HDF5")) : No installations match.

注:興味深いことに、この同じ私のデスクトップ上のコード(R内のファイルを読むことができる)も、ドライバを見つけることができてもエラーを返します。

私は、Rの外のコマンドラインでh4ファイルを探索できるので、ドライバが自分のコンピュータに存在することは当然知っています。私のコードは、デスクトップと同じデータ同じディレクトリ構造。

私は潜在的な競合を削除するか、(私はそのバージョンがしかし何であるかわからない!)正しいGDALのバージョンにRを指示するために、私のMac上で私のGDALのスレートをきれいにすることができますどのように任意のアイデア?これは私が取り組むするかどうかはわかりませんRへの結合GDALに関連付けられた特定のものです。

UPDATE: Rでこれを実行:

system("gdalinfo --version")

戻り値:

GDAL 1.11.5, released 2016/07/01

しかし、コマンドライン

gdalinfo --version

での

返し

GDAL 2.1.0, released 2016/04/25

は、任意のリードをありがとう... リア

UPDATES: は、私は最終的に2対GDAL 2をリンクして解除する方法を考え出したと私はどのように考え出しました

を:この時点で、しかしHDF4インストールするために醸造を使用し、私はここにチュートリアルを使用していますgdal2

を再インストールすることはできません

これは昨日働いていたが、その後、私はgdal2

brew remove gdal2 
# install h4 libraries 
brew install hdf4 

を削除し、その後、チュートリアルの指示に従って再インストールしようとしたにH4ライブラリをインストールする必要がありました。

==> Installing gdal2 from osgeo/osgeo4mac 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
Warning: Use cfitsio instead of deprecated homebrew/science/cfitsio 
==> Using Homebrew-provided fortran compiler. 
This may be changed by setting the FC environment variable. 
==> Downloading http://download.osgeo.org/gdal/2.2.1/gdal-2.2.1.tar.gz 
Already downloaded: /Users/leah-su/Library/Caches/Homebrew/gdal2-2.2.1.tar.gz 
==> ./configure --prefix=/usr/local/Cellar/gdal2/2.2.1 --mandir=/usr/local/Cella 
Last 15 lines from /Users/leah-su/Library/Logs/Homebrew/gdal2/01.configure: 
checking for SDget_maxopenfiles in -lmfhdf... yes 
checking for H5Fopen in -lhdf5... yes 
checking for kea-config... no 
checking for kea... no 
checking for nc-config... /usr/local/bin/nc-config 
checking libnetcdf compiler and linker flags with nc-config... 
got version="netCDF 4.4.1.1", prefix="/usr/local/Cellar/netcdf/4.4.1.1_6", 
libs="-L/usr/local/Cellar/netcdf/4.4.1.1_6/lib -lnetcdf -lhdf5_hl -lhdf5 -lsz -lz -ldl -lm -lcurl", includedir="/usr/local/Cellar/netcdf/4.4.1.1_6/include" 
checking for nc_open in -lnetcdf... yes 
checking for netcdf-4 (and HDF5) support in libnetcdf... yes 
checking for HDF4 support in libnetcdf... no 
configure: using JasPer library from /usr/local. 
checking for jp2_encode_uuid in -ljasper... no 
configure: hacked JasPer version not found, GeoJP2 disabled. 
configure: error: openjpeg.h not found in /usr/local/include/openjpeg-2.0 or /usr/local/include/openjpeg-2.1 

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core): 
https://github.com/osgeo/homebrew-osgeo4mac/issues 

These open issues may also help: 
brew install osgeo/osgeo4mac/gdal2-mrsid fails https://github.com/OSGeo/homebrew-osgeo4mac/issues/250 
Failed to build gdal2 with common flags https://github.com/OSGeo/homebrew-osgeo4mac/issues/245 
Cannot upgrade gdal2 on OS X 10.12.6 https://github.com/OSGeo/homebrew-osgeo4mac/issues/252 
Please add --without-pdfium option to gdal2 formula https://github.com/OSGeo/homebrew-osgeo4mac/issues/220 
Using osgeo4mac's gdal2 with homebrew core's postgis https://github.com/OSGeo/homebrew-osgeo4mac/issues/185 
gdal1-mrsid and gdal2-mrsid fails to build https://github.com/OSGeo/homebrew-osgeo4mac/issues/213 

`` `

答えて

1

[OK]を...そこにMacユーザーのために...私はしている:ここでは

は、私はこの時点で何を得る

$ brew install gdal2 --with-armadillo --with-complete --with-libkml --with-unsupported 

OUTPUTです最終的にこの問題を解決しました。 brew式のコードに行くと、gdalをbrew経由でインストールするときにhdf4がサポートされていないことがわかります。

これは私のコードで遭遇したことです。私は同様にコンドミニアムも類似していると思うし、osgeo/4macもそうだ。あなたはGDALをインストール

https://github.com/Homebrew/homebrew-core/blob/master/Formula/gdal.rb

https://github.com/OSGeo/homebrew-osgeo4mac

- Rは、最後にインストールされたバージョンを探しており、デフォルトであることを使用しています。ただし、.bash_profile文書でどのビルドを使用するかを指定できます。また、gdal 2.1を持つKing Chaosの配布はh4をサポートしています。だから私は何をしたのですか:

  1. KyngChaosに向かい、GDAL 2.1完全分布を得る。このサイトに関連付けられている最先端のウェブサイトのデザインで歓迎:)
  2. あなたのMacでgdal complete 2.1をインストールしてください。
  3. 次は、シェル経由bash_profile(それは隠しファイルです)

`` `

# go to your home directory in bash 
    cd 
    # open .bash_profile using your favorite text editor and whatever shortcut you have setup 
    vim .bash_profile 
    # add path to gdal to your profile (copy and paste or do it via shell) 
    export PATH=/Library/Frameworks/GDAL.framework/Programs:$PATH 
    # save and close 

` ``

最後に - R.でクリーンなものまで、あなたはgdalUtilsを使用していてもrgdal場合両方を必ず取り外してください。削除してから再インストールしてください。再起動R.

すべて動作するはずです。これは、同じ問題を持つ他の誰かに役立つことを願っています。

関連する問題