ConvertArealUnits (arcpyproduction.generalization)
サマリ
Converts native data units to area units such as square meters.
説明
This function is useful for converting the native data units to units that are easier to measure. For example, if the data is in decimal degrees, it is easier to identify a minimum distance value in square kilometers.
構文
ConvertArealUnits (dValue, layer)
パラメータ | 説明 | データ タイプ |
dValue |
The number of units and the unit of measure to be used, for example, 1000 square meters. | Double |
layer | The layer whose units will be converted. | Layer |
コードのサンプル
ConvertArealUnits example
This script converts the Facilities layer to square meters.
import arcpy
import arcpyproduction
from arcpyproduction import generalization
# set environment
arcpy.env.workspace="c:/Data/LocalGovernment.gdb"
# Check out Production Mapping license
arcpy.CheckOutExtension("Foundation")
# Define variables
inFeatures="ReferenceData/FacilitySite"
inFeatLayer="Facilities"
# create a feature layer
arcpy.MakeFeatureLayer_management(inFeatures,inFeatLayer)
# Execute ConverArealUnits
value=generalization.ConvertArealUnits("100 SquareMeters", inFeatLayer)
# describe inFeatLayer to determine its spatial reference units
desc=arcpy.Describe(inFeatLayer)
sr=desc.spatialReference
if sr.linearUnitName != '':
unit=sr.linearUnitName
print "Converted Square meters to {0} {1}".format(value,unit)
else:
print "Converted Square meters to {0}".format(value)
関連トピック
4/26/2014