获得 Production Mapping 许可后可用。
描述
Computes the magnetic field at point locations for a date and altitude you specify. Magnetic field values are written to one or more fields in the input point data. The magnetic value is calculated using the World Magnetic Model. The magnetic field values depend upon the magnetic component type. There are nine different magnetic component types. You can calculate all nine types into nine or more fields.
使用方法
Input Features (in_features) must be points. You can filter input points by applying a layer definition query or selection set.
Altitude specifies the elevation as a linear unit of the input points. Altitude must be a numeric value above sea level. To express this value in Python, use a combination of the unit value and type, enclosed in quotation marks ("3 meters"). Do not use decimal degrees or unknown units for Altitude.
Altitude applies the same elevation value to all points in Input Features (in_features for Python). To use a different altitude value for each input point, use a Feature Selection or Field Value iterator in ModelBuilder. The iterator can pass a value into the Altitude parameter. In this configuration, the tool runs once per input point.
Magnetic field values are written to existing fields. This tool does not create new fields. If you need to add a field, use the Add Field tool.
Magnetic Component Field(s) (magnetic_component_fields for Python) control the type of magnetic field calculation. You must specify a magnetic component and an existing field to write to. You can calculate up to nine different magnetic component types into nine or more existing fields.
To use the GRID_VARIATION magnetic component, you must set the ArcMap data frame coordinate system to Lambert Conformal Conic. If you specify GRID_VARIATION with another coordinate system, the tool returns ERROR 090033: Cannot get Lambert Conformal Conic projected coordinate system from environment settings or input feature class.
语法
arcpy.production.MagneticCalculator(in_features, altitude, date, magnetic_component_fields)
参数 | 说明 | 数据类型 |
in_features | The point features for which you want to calculate magnetic field values. | Feature Layer |
altitude | The in_features elevation including the linear unit. Linear units include CENTIMETERS | DECIMETERS | FEET | INCHES | KILOMETERS | METERS | MILES | MILLIMETERS | NAUTICAL MILES | POINTS | YARDS. | Linear unit |
date | The date for which you want to calculate magnetic field values. The date must be valid for the World Magnetic Model. The format must use two digits for the month, two digits for the day, and four digits for the year. Use "#", "", or None to use the current date. | Date |
magnetic_component_fields [magnetic_component_fields,...] | A list of magnetic component types and the fields the magnetic values will be written to. This list must contain one or more entries. The following component types can be used in the magnetic field calculation.
| Value Table |
代码示例
MagneticCalculator example 1 (Python window)
The following Python window script demonstrates how to use the MagneticCalculator tool.
# MagCalcPyWin.py
# Description: Computes a magnetic component field in a feature class
# data and feature layer
ElevP2 = "C:\\data\\TutorialsSamples\\TutorialsSamples\\Tutorials\\FeatureManager\\Edit_Sample.gdb\\Features\\ElevP"
ElevP_Layer = "ElevP_Layer"
arcpy.MakeFeatureLayer_management(ElevP2, ElevP_Layer)
# add a field to store the magnetic component
arcpy.AddField_management(ElevP_Layer, "declination", "LONG")
# invoke the tool
arcpy.MagneticCalculator_production("ElevP_Layer", "0 Meters", "10/7/2010", "DECLINATION declination")
MagneticCalculator example 2 (stand-alone script)
The following stand-alone script demonstrates how to use the MagneticCalculator tool.
# MagCalc.py
# Description: Computes 4 types of magnetic component fields in a feature class
# Import arcpy, the Production Mapping toolbox, and checkout a license
import arcpy
arcpy.CheckOutExtension("foundation")
# data variables
ElevP2 = "C:/data/TutorialsSamples/TutorialsSamples/Tutorials/FeatureManager/Edit_Sample.gdb/Features/ElevP"
ElevP_Layer = "ElevP_Layer"
# Make Feature Layer from the ElevP feature class
arcpy.MakeFeatureLayer_management(ElevP2, ElevP_Layer)
# Add 4 magnetic component fields
arcpy.AddField_management("ElevP_Layer","annualdrift","LONG")
arcpy.AddField_management("ElevP_Layer", "declination","LONG")
arcpy.AddField_management("ElevP_Layer","horizontal","LONG")
arcpy.AddField_management("ElevP_Layer","inclination","LONG")
# Pass a list of fields and their magnetic components to the MagneticCalculator function
arcpy.MagneticCalculator_production("ElevP_Layer","1 Feet","9/1/2010","ANNUAL_DRIFT annualdrift;DECLINATION declination;HORIZONTAL horizontal;INCLINATION inclination")
arcpy.CheckInExtension("foundation")
环境
许可信息
- Basic: 否
- Standard: 需要 Production Mapping
- Advanced: 需要 Production Mapping