ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • 帮助
  • Sign Out
ArcGIS Desktop

ArcGIS Online

专为贵组织打造的制图平台

ArcGIS Desktop

全面的专业性 GIS

ArcGIS Enterprise

面向企业的 GIS

ArcGIS Developers

用于构建位置感知应用程序的工具

ArcGIS Solutions

适用于行业的免费模板地图和应用程序

ArcGIS Marketplace

获取适用于组织的应用程序和数据

  • 文档
  • 支持
Esri
  • 登录
user
  • 我的个人资料
  • 登出

ArcMap

  • 主页
  • 入门
  • 地图
  • 分析
  • 管理数据
  • 工具
  • 扩展模块

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. 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.

提示:

This tool uses the model epoch specific to the date provided. For example, if the date specified is 2012, then the model epoch for 2010–2014 will be used.

使用方法

  • 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.

  • DECLINATION —Angle between magnetic north and true north. Varies by location on the globe.
  • ANNUAL_DRIFT —Annual rate of change in magnetic declination. Varies by location on the globe.
  • INCLINATION — Angle between a compass needle and the plane of the horizon. Varies by latitude. Also known as magnetic dip or the dip of the compass needle.
  • HORIZONTAL —Determined using north and east components. Also known as Horizontal intensity, or H. Varies by location on the globe.
  • EAST_COMPONENT —Easterly intensity of the geomagnetic field. Also known as Y. Varies by location on the globe.
  • NORTH_COMPONENT —Northerly intensity of the geomagnetic field. Also known as X. Varies by location on the globe.
  • VERTICAL_INTENSITY —Vertical intensity of the geomagnetic field. Also known as Z. Varies by location on the globe.
  • TOTAL_INTENSITY —Calculated using horizontal and vertical components. Also known as F. Varies by location on the globe.
  • GRID_VARIATION —Angle between magnetic north and grid north. You must use the Lambert Conformal Conic projected coordinate system in the ArcMap data frame, geoprocessing environment, or in the input point data.
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

相关主题

  • An overview of the Magnetic toolset

ArcGIS Desktop

  • 主页
  • 文档
  • 支持

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

关于 Esri

  • 关于我们
  • 招贤纳士
  • Esri 博客
  • 用户大会
  • 开发者峰会
Esri
分享您的想法。
Copyright © 2021 Esri. | 隐私政策 | 法律声明