Features To GPX (Conversion)

Summary

Converts point, multipoint, or polyline features to a GPX format file (.gpx).

Usage

  • The .gpx file collects points in two ways: waypoints and tracks. Waypoints are generally single unrelated points, while tracks compose a route or collection of related points with a start and end point. The type of point collected will be written to the appropriate GPX tag: WPT for waypoint or TRKPT for trackpoint. Waypoints can include a name and description for each individual point. Tracks include a name and description for the track, not for each individual point.

  • Line features will output as tracks (TRKS tag) and point and multipoint features will output as waypoints (WPT tag). You can only use one feature type as input, so the output .gpx file can contain either tracks or waypoints, not both.

  • In addition to the TRKS, TRKPT, and WPT tags, the tool can write additional tags to the output .gpx file. The tool includes parameters you can use to select the attribute field values to populate the following tags:

    • name—Name
    • desc—Description
    • elevation—Elevation
    • time—Date/time

  • The GPX format uses the WGS84 geographic coordinate system. If the input data is not in WGS84, the input features will be projected when written to the .gpx file. If a transformation is required, the best match is used. To control how your input features are projected, run the Project tool to convert your data to WGS84, choose the correct transformation, and use the projected features as input to this tool.

Parameters

LabelExplanationData Type
Input Features

The input point, multipoint, or line features.

Feature Layer
Output GPX File

The .gpx file that will be created with the geometry and attributes of the input features.

File
Name Field
(Optional)

A field from the input features with values used to populate the GPX name tag.

Field
Description Field
(Optional)

A field from the input features with values used to populate the GPX desc tag.

Field
Z Field
(Optional)

A numeric field from the input features with values used to populate the GPX elevation tag. If an elevation field is not specified, the z-values from the input features' geometries will be used to populate the GPX elevation tag.

Field
Date Field
(Optional)

A date/time field from the input features with values used to populate the GPX time tag.

Field

arcpy.conversion.FeaturesToGPX(in_features, out_gpx_file, {name_field}, {description_field}, {z_field}, {date_field})
NameExplanationData Type
in_features

The input point, multipoint, or line features.

Feature Layer
out_gpx_file

The .gpx file that will be created with the geometry and attributes of the input features.

File
name_field
(Optional)

A field from the input features with values used to populate the GPX name tag.

Field
description_field
(Optional)

A field from the input features with values used to populate the GPX desc tag.

Field
z_field
(Optional)

A numeric field from the input features with values used to populate the GPX elevation tag. If an elevation field is not specified, the z-values from the input features' geometries will be used to populate the GPX elevation tag.

Field
date_field
(Optional)

A date/time field from the input features with values used to populate the GPX time tag.

Field

Code sample

FeaturesToGPX example 1 (Python window)

The following Python snippet converts a point feature class to a GPX file from the Python window.

import arcpy

arcpy.env.workspace = r"C:/data/input/FeaturesToGPX.gdb/hurricanes"

arcpy.conversion.FeaturesToGPX("hurricanes", "hurricanes_out", "name", "serial_num", None, "myDate")
FeaturesToGPX example 2 (stand-alone script)

The following Python snippet converts a GPX file to features, selects the tracks, and creates a polyline feature class of those unique tracks.

# Name: FeaturesToGPX.py
# Description: Converts line features to a GPX track.

# Import system models
import arcpy

# Convert the line feature file to a GPX track with optional Name Field,
# Description Field, and Date Field
arcpy.conversion.FeaturesToGPX(r'C:\Data\Bike_Routes.gdb\Limekiln_Canyon', r'C:\Data\Output\Limekiln_Canyon.gpx', "RouteName", "SegmentLength", None, "Date")

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics