Converts the point information inside a GPX file into features.
This tool converts the point information inside a GPX file into 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 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, if desired, 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.
GPXtoFeatures_conversion (Input_GPX_File, Output_Feature_class)
The GPX file to convert.
The feature class to create.
The following Python snippet converts a GPX file into features from the Python window.
import arcpy arcpy.GPXtoFeatures_conversion('c:\\GPX_Files\\Hike.gpx', 'c:\\gisData\\Hike.shp')
The following Python snippet converts a GPX file into features and then 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')
- ArcGIS Desktop Basic: Yes
- ArcGIS Desktop Standard: Yes
- ArcGIS Desktop Advanced: Yes