I am looking to create my own 'heatmap' of all the bike rides I have recorded using the app Strava in QGIS.
I have over 450 individual gpx files and would like to merge the track points layers into one single shapefile so I can join them to a polygon layer and symbolise by join_count as seen in this example:
Some of my gpx files contain 'ride' in the file name and others 'run', I'd like to filter the files leaving only those with 'ride'.
How can I achieve this efficiently using QGIS?
Answer
Use the ogr2ogr command line tool, that is distributed with QGIS. In Windows, open the OSGeo4W Shell from the QGIS program group and enter
for %p in (path_to_gpx_files\*ride*.gpx) do ogr2ogr path_for_output\gpx.shp -append %p track_points -fieldTypeToString DateTime
The equivalent command in a Unix bash shell would be
for file in path_to_gpx_files/*ride*.gpx; do ogr2ogr path_for_output/gpx.shp -append "${file}" track_points -fieldTypeToString DateTime; done
Make sure the output file (gpx.shp) doesn't exist before, then ogr2ogr will produce one single shapefile from all gpx files with "ride" in it. There are some notes about the ogr gpx driver at http://www.gdal.org/drv_gpx.html .
No comments:
Post a Comment