============================================================================================ ==== Esri - Kevin Hibma (khibma@esri.com) ==== Creation Date: May 10, 2010 ==== ==== GPXtoFeatures.tbx : Toolbox which contains robust script tool to convert GPX files into a feature class ==== GPSTools.tbx : Toolbox which contains prior version of the script which is easily customizable for particular script conversion ==== ==== This tool/script is offered as-is. ============================================================================================ Usage: ======================= This Python script tool has been designed to function with ArcGIS 10 or 9.3.1 (version dependent) The script tool can be run from ArcGIS by supplying an input GPX (.gpx) file. *************************************************************************** Unless you need to modify the script to convert certain elements within your .GPX file, you should use the GPXtoFeatures toolbox found at the root level of the zip folder. *************************************************************************** Two GPX files are included within the zip for demonstration purposes. ##Note, this tool will be included in ArcGIS 10.1 within the Conversion Toolbox. When ArcGIS 10.1 is released, this sample will no longer be updated with enhancements or fixes. ZIP Contents: ====================== -GPXtoFeatures.tbx -gpx2feautures.py +DeveloperScripts -GPSTools.tbx -gpx2layer.py -GPS Tools931.tbx -gpx2layer931.py -AddExtensionElements.doc -HeliFlight.gpx -Jogging.gpx Developer Modification: ======================= The script within the DeveloperScript folder serves as an example for one particular way to parse XML and write the output as a featureclass. There are many ways to parse XML using Python. This sample makes use of ElementTree. Some other popular ways include Minidom or XPath. GPX in XML format conforms to a known schema. This schema can be enhanced depending on capture device to include more attributes. Currently the script captures and writes the following core attributes: -lat (latitude - double) -lon (longitude - double) -ele (elevation - double) -time (time - date or string) -Desc (description - string) Within the script additional entries can be added to the TRY block. Within the attached example is a heartrate field that is reflected within the Jogging.GPX file. The field is captured as "hr". Consult the specific device manufacturer or their website for information on enhancements to the base GPX schema (if exists). For GPX files without an "HR" attribute, a value of 0 (zero) will be added for each record. See the "AddExtensionElements.doc" for more detailed description on adding Extension Elements to suit your GPX files Changes Tracklog ====================== June 19, 2011 : Completely new script tool. Old script tools moved to "DeveloperScripts" folder. July 29, 2010 : added 9.3.1 version of the tool