Geoprocessing tool to convert GPX files into feature classes.
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:
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.
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.
You can convert features classes to GPX files with a sample tool available from arcgis.com. Alternatively, the Data Interoperability Extension can create GPX output.
Parameter | Explanation |
---|---|
Input_GPX_File |
The GPX file to convert. |
Output_Feature_class |
The feature class to create. |
GPXToFeatures Example 1 (Python Window)
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')
GPXToFeatures Example 2 (stand-alone script)
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')
There are no tags for this item.
There are no credits for this item.
There are no use limitations for this item.