LoginSignup
1
0

More than 3 years have passed since last update.

田周り最短経路アプリ

Last updated at Posted at 2020-03-01

田周りするときの最短経路を求めたい!

手順:

1.SiCroFをインストール(Ubuntu推奨!)

  1. ディレクトリSiCroFでインタラクティブモードを起動
➜  SiCroF ✗ python3 SiCroF.py
Detecting OS type...
OS : Linux
>
SiCroF >> Fortran Interactive mode for Linux & OS X... 
Here, fortran script runs with  SiCroF-kernel.
You can debug your code with SiCroF-API

>
>
Initializing ...
Please input fortran script *.f90 | or check manual by 'man'  

>>> 
  1. スクリプトファイル(Tutorial/RouteOptimization/RouteOpt1.f90)を呼び出す。
➜  SiCroF ✗ python3 SiCroF.py
Detecting OS type...
OS : Linux
>
SiCroF >> Fortran Interactive mode for Linux & OS X... 
Here, fortran script runs with  SiCroF-kernel.
You can debug your code with SiCroF-API

>
>
Initializing ... 
Please input fortran script *.f90 | or check manual by 'man'  

>>> Tutorial/RouteOptimization/RouteOpt1.f90

実行すると全ほ場の座標データが入った入力ファイルパスを聞かれるので、入力。
入力ファイルの形式は、

[全田圃数]
[田圃#1の緯度のgoogle map座標]  [田圃#1の経度のgoogle map座標] [田圃名(ローマ字)]
[田圃#2の緯度のgoogle map座標]  [田圃#2の経度のgoogle map座標] [田圃名(ローマ字)]
[田圃#3の緯度のgoogle map座標]  [田圃#3の経度のgoogle map座標] [田圃名(ローマ字)]
[田圃#4の緯度のgoogle map座標]  [田圃#4の経度のgoogle map座標] [田圃名(ローマ字)]
...

次に、入力ファイルのほ場のうち上から何筆まで指定するかを聞かれるので、1~[全田圃数]の間で値を入力。

計算が終わると、出力ファイルのパスを聞かれるので指定する(フルパス推奨、最後の/は不要)。

経路は出力ファイル内に RouteOpt_OptimalRoute.csv として出力されるので、google mymapなどで開く。

なお、以上の入出力をfortranスクリプトとして書くことも可能。

[2020/3/16追記]
Tutorial/RouteOptimization/RouteOptimization.pyにpythonAPIの使用例を追加しました。

import src.PySiCroFClass.SiCroF

obj=src.PySiCroFClass.SiCroF.routeOpt()
# Project=[WriteYourProjectDirectoryPath] (without / in the last)
# In [WriteYourProjectDirectory], please set a file named "Addresslist.txt"
obj.getOptimizedRoute(Project="Tutorial/RouteOptimization")
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0