|
現: 2023-07-26 (水) 13:44:10 yuji  |
| + | * phyghtmap [#r4310815] |
| + | [[phyghtmap>http://katze.tfiu.de/projects/phyghtmap/index.html]]は,[[NASA SRTM>https://www2.jpl.nasa.gov/srtm/]]データや[[GeoTIFF>https://ja.wikipedia.org/wiki/GeoTIFF]]データからOpenStreetMapの等高線データ(.osmファイル)を作成するツール。~ |
| + | 似たようなツールには[[srtm2osm>https://wiki.openstreetmap.org/wiki/Srtm2Osm#Download]]がある。 |
| | | |
| + | phyghtmapは特定のサーバーからNASA SRTMのデータをダウンロードして,それを.osmファイルの等高線データに変換してくれる。~ |
| + | 既にSRTMのデータがダウンロード済みの場合は,.osmファイルへの変換のみを行ってくれる。 |
| + | |
| + | [[phyghtmap>http://katze.tfiu.de/projects/phyghtmap/index.html]]はPython2.7やPython3.xで動作する。~ |
| + | - バージョン1.x~ |
| + | Python2.7で動作するバージョン。最終バージョンは1.80。~ |
| + | - バージョン2.x~ |
| + | Python3.xで動作するバージョン。最新バージョンは2.23。~ |
| + | |
| + | バージョン1.70からGeoTIFFをサポートしている。~ |
| + | |
| + | バージョン1.80以降でSRTMのデータをダウンロードするサイトが[[NASAのEarthdata>https://urs.earthdata.nasa.gov/]]へ変更された。予めアカウントを[[Earthdataのアカウント作成ページ>https://urs.earthdata.nasa.gov/users/new/]]でユーザー登録しておく必要がある。~ |
| + | phyghtmapを最初に使用するときに,オプション--earthdata-userでユーザー名を,--earthdata-passwordでパスワードを指定する。HOMEディレクトリに''.phyghtmaprc''ファイルが作成され,以後はユーザー名・パスワードは必要ない。~ |
| + | |
| + | バージョン2.10以降でSRTMのデータをダウンロードするサイトがNSAのEarthdataから[[USGSのEarthExplorer>https://ers.cr.usgs.gov/]](EROSデータセンター)に変更された。予めアカウントを[[EarthExplorerのアカウント作成ページ>https://ers.cr.usgs.gov/register/]]でユーザー登録しておく必要がある。~ |
| + | phyghtmapを最初に使用するときに,オプション--earthexplorer-userでユーザー名を,--earthexplorer-passwordでパスワードを指定する。HOMEディレクトリに''.phyghtmaprc''ファイルが作成され,以後はユーザー名・パスワードは必要ない。~ |
| + | |
| + | 使い方: [[phyghtmap man page>http://katze.tfiu.de/projects/phyghtmap/phyghtmap.1.html]] |
| + | |
| + | ** Windowsマシンにphyghtmapをインストール [#d3ea8d02] |
| + | Pythonを標準のインストーラーでWindowsマシンへインストールしている環境と,MSYS2/MinGW-w64環境でインストールしている環境で,phyghtmapをインストールしてみた。~ |
| + | |
| + | *** Pythonを標準インストーラーでインストールしている場合 [#s21b0035] |
| + | Python 3.9を[[公式のインストーラー>https://www.python.org/downloads/windows/]]でインストールしている環境に,phyghtmap 2.23をインストールした。~ |
| + | |
| + | コマンドプロンプトを起動して,pipコマンドでいくつかのPythonモジュールをバージョン指定してインストールする。~ |
| + | GDALはWheelファイル&ref(GDAL-3.3.3-cp39-cp39-win_amd64.whl);でインストールした。~ |
| + | > python -m pip install beautifulsoup4==4.12.2 |
| + | > python -m pip install numpy==1.22.2 |
| + | > python -m pip install lxml==4.9.3 |
| + | > python -m pip install matplotlib==3.3.0 |
| + | > python -m pip install GDAL-3.3.3-cp39-cp39-win_amd64.whl |
| + | |
| + | 次にphyghtmap 2.23のインストールを行う。~ |
| + | phyghtmap 2.23のソースコードをダウンロードして,インストールした。~ |
| + | > wget http://katze.tfiu.de/projects/phyghtmap/phyghtmap_2.23.orig.tar.gz |
| + | > tar zxvf phyghtmap_2.23.orig.tar.gz |
| + | > cd phyghtmap-2.23 |
| + | > python setup.py install |
| + | |
| + | エラー等がなければインストール出来ている。~ |
| + | |
| + | インストールの確認をする。~ |
| + | > phyghtmap --version |
| + | phyghtmap 2.23 |
| + | |
| + | *** MSYS2/MinGW-w64環境でPythonをインストールしている場合 [#cd5d7cd9] |
| + | Windowsマシンに既にMSYS2/MinGW-w64環境が構築されていて''Python3.10.12''がインストールされている場合に,phyghtmap 2.23をインストールした。~ |
| + | |
| + | MSYS2/MinGW64環境でPythonをインストールする場合, |
| + | $ pacman -S mingw-w64-x86_64-python mingw-w64-x86_64-python-setuptools mingw-w64-x86_64-python-pip |
| + | |
| + | とすればインストールできる。 |
| + | しかし,その後pacmanでPythonやPythonモジュールが3.11ベースに更新されてしまうと,phyghtmap 2.23がうまく動作しなくなってしまった。~ |
| + | なのでバージョンが更新がされないように,''/etc/pacman.conf''ファイルで更新対象から外すようにしておいたほうがとりあえず良いと思われる。~ |
| + | |
| + | ''/etc/pacman.conf''ファイル~ |
| + | ignorePkg = mingw-w64-x86_64-python* mingw-w64-x86_64-gdal mingw-w64-i686-python* mingw-w64-i686-gdal |
| + | |
| + | phyghtmap 2.23で必要ないくつかのPythonモジュールをパッケージ管理ツールでインストールした。~ |
| + | beautifulsoup4==4.12.2,GDAL==3.7.0がインストールされた。~ |
| + | $ pacman -S mingw-w64-x86_64-python-beautifulsoup4 mingw-w64-x86_64-python-gdal |
| + | |
| + | pacmanでmingw-w64-x86_64-python-matplotlibとmingw-w64-x86_64-python-numpyをインストールすると,時期によるがmatplotlib==3.7.1,numpy==1.25.1がインストールされてしまう。~ |
| + | |
| + | matplotlib==3.7.1やnumpy==1.25.1がインストールされた場合,phyghtmap 2.23だとうまく動作しなかった。~ |
| + | なので一旦これらをアンインストールして,古いバージョンのmatplotlib==3.5.3(&ref(mingw-w64-x86_64-python-matplotlib-3.5.3-1-any.pkg.tar.zst);)とnumpy==1.23.5(&ref(mingw-w64-x86_64-python-numpy-1.23.5-1-any.pkg.tar.zst);)を,zstファイルを使ってパッケージ管理ツールでインストールした。~ |
| + | $ pacman -U mingw-w64-x86_64-python-matplotlib-3.5.3-1-any.pkg.tar.zst |
| + | $ pacman -U mingw-w64-x86_64-python-numpy-1.23.5-1-any.pkg.tar.zst |
| + | |
| + | 次に,phyghtmap 2.23のソースコードをダウンロードする。~ |
| + | $ wget http://katze.tfiu.de/projects/phyghtmap/phyghtmap_2.23.orig.tar.gz |
| + | $ tar zxvf phyghtmap_2.23.orig.tar.gz |
| + | $ cd phyghtmap-2.23 |
| + | |
| + | phyghtmap 2.23のソースコードに自作のパッチを当てる。~ |
| + | パッチファイル:&ref(hgt.patch); &ref(osmUtil.patch); &ref(pdfUtil.patch);をphyghtmapディレクトリにコピーする。~ |
| + | $ cd phyghtmap |
| + | $ patch -p0 < hgt.patch |
| + | $ pache -p0 < osmUtil.patch |
| + | $ pache -p0 < pbfUtil.patch |
| + | |
| + | phyghtmap 2.23をインストールする。~ |
| + | $ python setup.py install |
| + | |
| + | インストールの確認をする。~ |
| + | $ phyghtmap --version |
| + | phyghtmap 2.23 |
| + | |
| + | ** Linuxマシンにphyghtmapをインストール [#p8eaf541] |
| + | CentOSやUbuntuなどのLinuxマシンに,phyghtmapをインストールする。~ |
| + | |
| + | *** CentOS 7.9(2009)にインストールする [#x129d009] |
| + | Python3(Python 3.9.12)が既にインストールされている環境に,phyghtmapをインストールする。~ |
| + | |
| + | pipで必要なモジュールをバージョン指定してインストールしてみた。~ |
| + | この時,GDALはWheelファイル&ref(GDAL-3.3.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl);でインストールした。 |
| + | ~ |
| + | # pip3 install beautifulsoup4==4.12.2 |
| + | # pip3 install matplotlib==3.3.0 |
| + | # pip3 install numpy==1.22.2 |
| + | # pip3 install lxml==4.9.3 |
| + | # pip3 install GDAL-3.3.3-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl |
| + | |
| + | phyghtmap 2.23のソースコードをダウンロードする。 |
| + | $ wget http://katze.tfiu.de/projects/phyghtmap/phyghtmap_2.23.orig.tar.gz |
| + | $ tar zxvf phyghtmap_2.23.orig.tar.gz |
| + | $ cd phyghtmap-2.23 |
| + | |
| + | phyghtmap 2.23のインストールを行う。~ |
| + | $ python3 setup.py install |
| + | |
| + | インストールが出来たか確認してみる。~ |
| + | $ phyghtmap --version |
| + | phyghtmap 2.23 |
| + | |
| + | *** Ubuntu 22.04LTSにインストール [#a3c0e217] |
| + | Python3(Python 3.10.6)が既にインストールされている環境に,phyghtmapをインストールする。~ |
| + | |
| + | パッケージ管理ツールで,必要なpythonモジュールをインストールする。~ |
| + | # apt install python3-matplotlib python3-bs4 python3-numpy python3-lxml python3-gdal |
| + | |
| + | 各モジュールのバージョンは以下がインストールされた。~ |
| + | - python3-matplotlib(3.5.1)~ |
| + | - python3-bs4(4.10.0)~ |
| + | - python3-numpy(1.21.5)~ |
| + | - python3-lxml(4.8.0)~ |
| + | - python3-gdal(3.4.1)~ |
| + | |
| + | phyghtmap 2.23のソースコードをダウンロードする。~ |
| + | $ wget http://katze.tfiu.de/projects/phyghtmap/phyghtmap_2.23.orig.tar.gz |
| + | $ tar zxvf phyghtmap_2.23.orig.tar.gz |
| + | $ cd phyghtmap-2.23 |
| + | |
| + | phyghtmap 2.23のソースコードに自作のパッチを当てる。~ |
| + | パッチファイル:&ref(hgt.patch); &ref(osmUtil.patch); &ref(pdfUtil.patch);をphyghtmapディレクトリにコピーする。~ |
| + | $ cd phyghtmap |
| + | $ patch -p0 < hgt.patch |
| + | $ pache -p0 < osmUtil.patch |
| + | $ pache -p0 < pbfUtil.patch |
| + | |
| + | phyghtmapをインストールする。~ |
| + | $ python3 setup.py install |
| + | |
| + | インストールが出来たか確認してみる。~ |
| + | $ phyghtmap --version |
| + | phyghtmap 2.23 |