Converts the point information inside a GPX file to features.
This tool converts the point information inside a GPX file to features. The output features will include the geometry (including elevation or Z-value) as well as following attribute fields:
- DateTimeS—A string data type.
- DateTime—A date data type. Shapefiles do not allow date field types to contain both date and time; they only support the date (no time). Output shapefiles will only have a DateTimeS field. All other output format types will attempt to create a DateTime field as long as the date format complies to the XML Time standard. Most GPX files follow the XML Time standard. For more information on shapefiles and their limitations, see Geoprocessing considerations for shapefile output.
GPX files collect points in two ways: waypoints and tracks. Waypoints are generally single unrelated points, while tracks make up a route or collection of related points with a start and end point. The type of point collected is specified in the output Type field by the code WPT (waypoint) or TRKPT (track point). Waypoints can have a name and description for each individual point. Tracks have a name and description associated with the track itself, not for each individual point.
You can use the Points To Line tool to create lines for each track.
- Use the Select Layer By Attribute tool to select track points with the expression: TYPE = "TRKPT".
- Use the selected features as input to the Points To Line tool. In the Line Field parameter of the Points To Line tool, choose the Name field to create unique tracks.
The Python code below shows how this workflow is accomplished using a script.
Output will be generated in the WGS84 coordinate system. The output features can be reprojected to another coordinate system using the Project tool.
Both the 1.0 and 1.1 Topografix GPX schemas are supported. Files that do not conform to one of these schemas will not translate.
The GPX file to convert.
The feature class to create.
GPXToFeatures example 1 (Python window)
The following Python snippet converts a GPX file to features from the Python window.
import arcpy arcpy.GPXtoFeatures_conversion('c:\\GPX_Files\\Hike.gpx', 'c:\\gisData\\Hike.shp')
GPXToFeatures 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: ConvertMultiTracks.py # Description: Converts multiple tracks within a single GPX file into # individual line segments # Import system models import arcpy # Convert the GPX file into in_memory features arcpy.GPXtoFeatures_conversion('c:\\GPX_Files\\MultiHike.gpx', 'in_memory\hikes') # Select only the track points arcpy.SelectLayerByAttribute_management('in_memory\hikes', 'NEW_SELECTION', "\"Type\" = 'TRKPT'") # Convert the tracks into lines. The 'Name' field creates unique tracks. arcpy.PointsToLine_management('in_memory\hikes', 'c:\\output\HikeTracks.shp', 'Name', '#', 'NO_CLOSE')
- Basic: Yes
- Standard: Yes
- Advanced: Yes