ptrv/gpx2spatialite does this remarkably well, saving timestamps for all points and deriving speed and length data for tracks. It also won't import duplicate tracks, so you can feed it a huge pile for GPX files and it will munge them appropriately.
Update: usage examples, as requested:
Initialize new database:
gpx2spatialite_create_db db.sqlite
Add a single gpx file:
gpx2spatialite -d db.sqlite -u user file.gpx
(If username user does not exist in the database, will query if you wish to create it. The database is built with tracks/waypoints/routes assigned to one or more users.)
Add all of the gpx files in folder/:
gpx2spatialite -d db.sqlite -u user folder/
Usage: it's a spatial database, with table tracklines holding the tracks as polylines, trackpoints containing the individual points (with time, elevation, etc), and waypoints for any defined waypoints. There are also numerous indices, some world city definitions and possibly also embedded SLD styling information I haven't yet explored. As a trivial example, here's a map of how my hometown (Toronto) is defined through ~7 years of track logs:
By using lines at 75% transparency, the most frequently-travelled routes become darker.
I don't know if I have understood what you are looking for, but there is the Line-polygon intersection
SAGA tool that should do the job.
The following is a workflow which you could simply implement in a model or in a PyQGIS script:
- convert the polygon to lines with the
Polygons to lines
tool;
- run the
Line-polygon intersection
SAGA tool setting keep original line attributes
as parameter;
- run the
Dissolve tool
(uncheck the Dissolve all (do not use fields)
parameter and move the Stb
field in the Selected
box).
You will obtain this result (16 line features):
I styled it with a different color for each feature (you can't see some lines because they overlap, but they exist).
Best Answer
Assuming that you understand German, you can use my Openlayers solution to display GPX tracks and waypoints on top of OSM or other tiles:
http://wiki.openstreetmap.org/wiki/User:Ajoessen/Osmviewer_und_GPXviewer
EDIT
Removed the files since they don't work anymore with modern browsers.