Magnetic Calculator (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. Date values must fall between 1/1/2005 and 12/31/2014. 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 quotes ("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). 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) 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 ArcMap's 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.
语法
参数 | 说明 | 数据类型 |
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 between January 1, 2005, and December 31, 2014. 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 |
代码实例
The following stand-alone script demonstrates how to use the MagneticCalculator tool.
# Name: MagneticCalculator_Example.py
# Description: Computes 4 types of magnetic component fields in a feature class
# Requires: Esri Production Mapping
import arcpy
# checkout a license and set gp environment
arcpy.CheckOutExtension("foundation")
arcpy.env.workspace="c:/data/Austin.gdb"
# data variables
elevations = "TopographicMap/ElevationP"
elevationsLyr = "elevationsLyr"
# make an elevations feature layer
arcpy.MakeFeatureLayer_management(elevations, elevationsLyr)
# add 4 magnetic component fields
arcpy.AddField_management("elevationsLyr","annualdrift","LONG")
arcpy.AddField_management("elevationsLyr", "declination","LONG")
arcpy.AddField_management("elevationsLyr","horizontal","LONG")
arcpy.AddField_management("elevationsLyr","inclination","LONG")
# altitude, magnetic date and component fields list
alt="1 Feet"
magDate="9/1/2010"
fieldsList="ANNUAL_DRIFT annualdrift;DECLINATION declination;HORIZONTAL horizontal;INCLINATION inclination"
# exec the MagneticCalculator function
arcpy.MagneticCalculator_production(elevationsLyr,alt,magDate,fieldsList)
print arcpy.GetMessages()
The following Python window script demonstrates how to use the MagneticCalculator tool.
import arcpy
# set gp environment
arcpy.env.workspace="c:/data/Austin.gdb"
# elevation data
elevations = "TopographicMap/ElevationP"
elevationsLyr = "elevationsLyr"
# make an elevations feature layer
arcpy.MakeFeatureLayer_management(elevations, elevationsLyr)
# add a field to store the magnetic component
arcpy.AddField_management("elevationsLyr", "declination","LONG")
# altitude, magnetic date and component fields list
alt="0 Meters"
magDate="10/7/2010"
fieldsList="DECLINATION declination"
# invoke the tool
arcpy.MagneticCalculator_production(elevationsLyr,alt,magDate,fieldsList)