- Objective
- Installation
- Library Installation
- Functions Used in Libraries
- Example
- Code Development
- Contributing
- Contact
The goal of this code is to find the best interpolation method for quantitative data and predict other areas in GIS. The selected methods will be evaluated using metrics such as RSME, R, MABE, MAPE, etc. For more details, click here.
Clone the repository:
git clone https://github.com/yourusername/yourproject.git
cd yourproject
This library is installed by default and is recognized as pd in the code.
If ArcMap or ArcGIS Pro software is installed, arcpy is installed by default.
-
Install Anaconda.
-
Remove all environments cloned from Anaconda through the package manager of Anaconda or ArcGIS Pro.
-
Open the Conda prompt for ArcGIS from the following address:
C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\proenv.bat
-
Clone from
arcgispro-py3
using the following command:conda create --name gisenv --clone arcgispro-py3
Note: You can use any name instead of gisenv.
-
Activate the environment created in step 3 using the following command:
activate gisenv
-
Install geopandas and its required packages using the following commands:
pip install geopandas
pip install folium
pip install matplotlib
pip install mapclassify
- Install Anaconda.
- Remove all environments cloned from Anaconda through the package manager of Anaconda or ArcGIS Pro.
- Open the Conda prompt for ArcGIS from the following address:
C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\proenv.bat
- Clone from
arcgispro-py3
using the following command:
conda create --name gisenv --clone arcgispro-py3
Note: You can use any name instead of gisenv.
- Activate the environment created in step 3 using the following command:
activate gisenv
- Install rasterio using the following command:
pip install rasterio
- Install Anaconda.
- Remove all environments cloned from Anaconda through the package manager of Anaconda or ArcGIS Pro.
- Open the Conda prompt for ArcGIS from the following address:
C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\proenv.bat
- Clone from
arcgispro-py3
using the following command:
conda create --name gisenv --clone arcgispro-py3
Note: You can use any name instead of gisenv.
- Activate the environment created in step 3 using the following command:
activate gisenv
- Install permetrics using the following commands:
git clone https://github.com/thieu1995/permetrics.git
cd permetrics
python setup.py install
Function Name | Input Parameters | Output Type | Link |
---|---|---|---|
read_excel | ExcelFile, Sheet Name | DataFrame | Link |
iterrows | None | Row in DataFrame | Link |
drop | Labels, Axis | DataFrame or None | Link |
at | Row, Column | Everything | Link |
DataFrame | Data, Index | DataFrame | Link |
columns | Origin, Destination | Object | Link |
rename | Dictionary | DataFrame | Link |
merge | DataFrame, On, How | DataFrame | Link |
to_excel | ExcelFile, Index | Excel | Link |
Function Name | Input Parameters | Output Type | Link |
---|---|---|---|
sa.Idw | Shapefile or Feature Class, Z_Field, Method, Cell_Size | Raster | Link |
sa.Kriging | Shapefile or Feature Class, Z_Field, Method, Cell_Size | Raster | Link |
sa.Spline | Shapefile or Feature Class, Z_Field, Method, Cell_Size | Raster | Link |
Function Name | Input Parameters | Output Type | Link |
---|---|---|---|
GeoDataFrame | Data, Geometry | GeoDataFrame | Link |
points_from_xy | Longitude, Latitude | Point | Link |
set_crs | EPSG, Inplace | Int | Link |
to_file | Filename, Driver, Encoding | Everything | Link |
Function Name | Input Parameters | Output Type | Link |
---|---|---|---|
open | Raster | File | Link |
index | Longitude, Latitude | Tuple | Link |
read | 1, Window | Array | Link |
Function Name | Input Parameters | Output Type | Link |
---|---|---|---|
RegressionMetric | Y_true, Y_pred | RegressionMetric | Link |
mean_bias_error | None | Double | Link |
root_mean_squared_error | None | Double | Link |
mean_percentage_error | None | Double | Link |
pearson_correlation_coefficient | None | Double | Link |
The table below is based on the YouTube video.
The file is sample.xlsx.
This file is model.xlsx.
workspace: The address where the interpolation.gdb file should be created.
address_input: The address of the sample Excel file.
zone: The study zone, which is between 38 and 41 for Iran.
raster_address: By default, it is C:\temp.tif. If it gives an error, change the image address, and it will work correctly.
address_model: The address of the model Excel file.
program: Continue the program or not.
Column 2 should be x, and column 3 should be y.
field: Reads from the model Excel.
final_Excel: Asks for the final Excel address.
start_column: Stores the column number of methods, which is 4 by default.
evaluate_Excel: Asks for the evaluation Excel address.
Final Excel:
Evaluation Excel:
The variables are as follows:
if interpolation_type == "Idw":
out_raster = arcpy.sa.Idw(temp_address, field, method)
elif interpolation_type == "Kriging":
out_raster = arcpy.sa.Kriging(temp_address, method, field)
elif interpolation_type == "Spline":
out_raster = arcpy.sa.Spline(temp_address, field, spline_type=method)
else:
return None
if method == "MBE":
res = evaluator.mean_bias_error()
res_dict[i] = [col, res]
elif method == "RMSE":
res = evaluator.root_mean_squared_error()
res_dict[i] = [col, res]
elif method == "MAPE":
res = evaluator.mean_percentage_error()
res_dict[i] = [col, res]
elif method == "R":
res = evaluator.pearson_correlation_coefficient()
res_dict[i] = [col, res]
else:
return None
-
Fork the repository.
-
Create a new branch:
git checkout -b feature-newfeature
. -
Commit changes:
git commit -m 'Add new feature'
. -
Push to the branch:
git push origin feature-newfeature
. -
Submit a pull request.
- Email: [email protected]
- Telegram : mttaherpoor