Calculate Magnetic Components (Topographic Production)

Available with Production Mapping license.


Computes the magnetic field at point locations for given date and altitude.



    This tool modifies the input data. See Tools that modify or update the input data for more information and strategies to avoid undesired data changes.

  • The Input Features parameter value must be points. You can filter input points by applying a layer definition query or selection set.

  • The Altitude parameter specifies the elevation as a linear unit of the input points. The Altitude value must be a numeric value above sea level. Do not use decimal degrees or unknown units.

  • The Altitude parameter applies the same elevation value to all points in the Input Features parameter. To use a different altitude value for each input point, use the Iterate Feature Selection or Iterate Field Value tool in ModelBuilder. The iterator can pass a value to 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 fields. To add a field, use the Add Field tool.

  • The Magnetic Component parameter field controls 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 magnetic component types.

  • To use the Grid variation magnetic component, you must set the ArcGIS Pro data frame coordinate system to Lambert Conformal Conic. If you specify Grid variation with another coordinate system, the tool will fail.

  • This tool uses the World Magnetic Model 5-year epoch specific to the data provided. For example, if the data specified is from 2020, the model epoch released at the end of 2019 is used.


arcpy.topographic.CalculateMagneticComponents(in_features, altitude, date, magnetic_component)
ParameterExplanationData Type

The point features for which magnetic field values will be calculated.

Feature Layer

The elevation of the in_features value including the linear unit. Do not use decimal degrees or unknown units. The default is 0 meters.

Linear Unit

The date for which magnetic field values will be calculated. The date must be valid for the specified World Magnetic Model. The format must use two digits for the month, two digits for the day, and four digits for the year. The default is the system current date.

[[component, field],...]

The magnetic component to calculate and the field to which the values will be written.

  • Component—The magnetic component to calculate.
    • DECLINATION—The angle between magnetic north and true north. This value varies by location on the globe.
    • ANNUAL_DRIFT—The annual rate of change in magnetic declination. This value varies by location on the globe.
    • INCLINATION—The angle between a compass needle and the plane of the horizon. Inclination is also known as magnetic dip or the dip of the compass needle. This value varies by latitude.
    • HORIZONTAL—This value is calculated using north and east components. Horizontal is also known as Horizontal intensity, or H. This value varies by location on the globe.
    • EAST_COMPONENT—The easterly intensity of the geomagnetic field. East component is also known as Y. This value varies by location on the globe.
    • NORTH_COMPONENT—The northerly intensity of the geomagnetic field. North component is also known as X. This value varies by location on the globe.
    • VERTICAL_INTENSITY—The vertical intensity of the geomagnetic field. Vertical intensity is also known as Z. This value varies by location on the globe.
    • TOTAL_INTENSITY—This value is calculated using horizontal and vertical components. Total intensity is also known as F. This value varies by location on the globe.
    • GRID_VARIATION—The angle between magnetic north and grid north. You must use the Lambert conformal conic projected coordinate system in the ArcMap data frame, in the geoprocessing environment, or in the input point data.
  • Field—The field to which calculated results are written.

Value Table

Derived Output

NameExplanationData Type

The in_features layer with the chosen fields updated.

Feature Layer

Code sample

CalculateMagneticComponents example (stand-alone script)

The following code sample demonstrates how to use the CalculateMagneticComponents tool in Python.

# Name:
# Description: Calculates four types of magnetic component fields for a feature class.

# Import System Modules
import arcpy

# Check Out Extensions

# Setting Data Variables
ElevP2 = r'C:\Data\Edit_Sample.gdb\Features\ElevP'
ElevP_Layer = 'ElevP_Layer'

# Make Feature Layer from the ElevP feature class
arcpy.MakeFeatureLayer_management(ElevP2, ElevP_Layer)

# Add four magnetic component fields
arcpy.AddField_management('ElevP_Layer', 'Declination', 'LONG')
arcpy.AddField_management('ElevP_Layer', 'Annual_Drift', 'LONG')
arcpy.AddField_management('ElevP_Layer', 'Inclination', 'LONG')
arcpy.AddField_management('ElevP_Layer', 'Horizontal', 'LONG')

# Setting Local Variables
altitude = '1 Feet'
date = '1/1/2010'
magnetic_component = 'DECLINATION Declination;ANNUAL_DRIFT Annual_Drift;INCLINATION Inclination;HORIZONTAL Horizontal'

# Execute Calculate Magnetic Components
arcpy.CalculateMagneticComponents_topographic('ElevP_Layer', altitude, date, magnetic_component)

# Check In Extensions


Licensing information

  • Basic: No
  • Standard: Requires Production Mapping
  • Advanced: Requires Production Mapping

Related topics