* (Multiplication) operator

Spatial Analyst のライセンスで利用可能。

Image Analyst ライセンスで利用できます。

概要

Multiplies the values of two rasters on a cell-by-cell basis.

ディスカッション

ラスター入力で演算子を使用すると、結果はラスターになります。ただし、すべての入力値が数字の場合、結果は数字になります。

この演算子では、入力の順序は結果に影響しません。

構文

`in_raster_or_constant1 * in_raster_or_constant2`
 オペランド 説明 データ タイプ in_raster_or_constant1 The input containing the values to be multiplied. If one of the inputs is a raster and the other is a scalar, an output raster is created with each cell in the input raster being multiplied by the scalar. Raster Layer | Constant in_raster_or_constant2 The input containing the values by which the first input will be multiplied.If one of the inputs is a raster and the other is a scalar, an output raster is created with each cell in the input raster being multiplied by the scalar. Raster Layer | Constant

戻り値

 名前 説明 データ タイプ out_raster 出力ラスター オブジェクト。The cell values are the product of the first input multiplied by the second. Raster

コードのサンプル

* (Multiplication) example 1 (Python window)

This sample multiplies the values of an input elevation raster by a constant value to convert the elevation values from meters to feet.

``````import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outTimes = Raster("elevation") * 0.3048
outTimes.save("C:/sapyexamples/output/outtimes")``````
* (Multiplication) example 2 (stand-alone script)

This sample multiplies the values of an input elevation raster by a constant value to convert the elevation values from meters to feet.

``````# Name: Op_Times_Ex_02.py
# Description: Multiplies the values of two rasters on a cell-by-cell basis.
# Requirements: Spatial Analyst Extension

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

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

# Set local variables
inRaster = Raster("elevation")
inConstant = 0.3048

# Execute Times
outTimes = inRaster * inConstant

# Save the output
outTimes.save("C:/sapyexamples/output/timesout")``````