# 在 Image Analyst 中使用地图代数快速浏览

``````from arcpy.ia import *
elevationPlus100 = Plus("inelevation", 100)``````

## 地图代数基础知识

• 栅格计算器工具
• Python 窗口
• Python 集成式开发环境 (IDE)

### Python 窗口

Python 窗口的部分功能包括：自动完成内置行、使用变量，以及访问 PythonArcPy 功能。

### Python 集成式开发环境

``````# Name: Image Classification
# Description:
# Requirements: Image Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.ia import *

# Check out the ArcGIS Image Analyst extension license
arcpy.CheckOutExtension("ImageAnalyst")

# Set environment settings
env.workspace = "C:/data"

# Set local variables
inRaster = "Landsat8_Redlands.tif"
classification_file = "LandCover.ecd"

# Run Classify Raster
outLandCover = ClassifyRaster(inRaster, classification_file)

# Save the output
outLandCover.save("C:/data/Landcover.tif")``````

Python 窗口一样，IDE 可用于访问所有可用的 PythonArcPy 功能。

## 运算符

``````# set outVar to 14 using the Python + operator
outVar = 5 + 9``````

``outRas = Raster("inras1.tif") + Raster("inras2.tif")``

``outRas = Raster("inras1.tif") + 8``

## 复杂表达式

``````outRas = Slope("indem" * 2) / 57
outdist = EucDistance(ExtractByAttributes("inras", "Value > 105"))``````

``outRas1 = (Raster("inras1") + Raster("inras2")) / Raster("inras3")``

``outRas2 = Raster("inras1") + Raster("inras2") / Raster("inras3")``

## 地图代数语句的建议

``````import arcpy
from arcpy import env
from arcpy.ia import *

env.workspace = "C:/data"

outLandCover = ClassifyRaster("Landsat8_Redlands", "LandCover.ecd")

outLandCover.save("RedlandsLandcover")``````