I have a large number (many hundreds) of GPS tracks in gpx format which cover much of Britain, including some from other parts of the world. I want to pick out only those that pass through a specific small area of London. I can't think of an obvious way to do this short of viewing each one individually and saving relevant ones to a separate folder. Can anyone suggest a way to automate this? (Hope it's ok to post this as it's not strictly speaking an OSM question... but it relates to a project which will use OSM data.) asked 04 Nov '15, 14:40 SDavies aseerel4c26 ♦ |
If you do not need the original file name of the gpx and also do not need the original time stamps, but just the relevant trace itself, then you could use the OSM-Editor JOSM for this:
note: Please do not "upload" such converted gpx tracks to OSM with JOSM's normal upload feature! Best: restart JOSM before you continue with your normal OSM contributions/editing. answered 04 Nov '15, 19:34 aseerel4c26 ♦ Thanks for this aseerel4c26, that is much appreciated. I will try this.
(05 Nov '15, 05:28)
SDavies
3
Have now tried this and it pretty much got me where I want to be, so thanks again.
(05 Nov '15, 22:06)
SDavies
@SDavies: thanks for the feedback! :-)
(06 Nov '15, 05:26)
aseerel4c26 ♦
|
Some of the tools listed there https://wiki.openstreetmap.org/wiki/Edit_GPS_tracks may help answered 04 Nov '15, 19:34 aseerel4c26 ♦ |
I would turn to OSGeo tools for this. A very quick check shows that ogrinfo will provide information about a wide range of files containing geographic information, including GPX. Part of this information is extents of the file, or layer. So post-processing gdalinfo output (as simple as grepping for "Extents" could provide you a listing of the extents for each gpx file. Once you have the information it may be useful to store it in a spatial database to easily relocated relevant GPX files. answered 06 Nov '15, 11:43 SK53 ♦ Hmm, does "extents" mean the bounding box of the trace? This may not be useful if "passing" (from the question) means that the trace actually runs trough an area (what I have understood).
(06 Nov '15, 17:18)
aseerel4c26 ♦
You can use ogrinfo to look for features in a bounding box as well. Perhaps I will rephrase the answer, but either way this is a more practical way than JOSM. I have perhaps 5-6000 traces (typically several for every day since I started contributing to OSM).
(07 Nov '15, 10:49)
SK53 ♦
the josm thing is just handy for a very limited number of repetitions and number of selected traces, yes.
(07 Nov '15, 12:51)
aseerel4c26 ♦
QGIS is another route for a limited number of traces
(08 Nov '15, 16:50)
SK53 ♦
|
Echoing the SK53 answer "I would turn to OSGeo tools for this", but instead of ogrinfo, use ogr2ogr to convert your GPX traces into a shape file (possibly running ogr2ogr multiple times with the same output file, using -append from the second run on), and then again use ogr2ogr with the -spat option and a London bounding box to select those traces that go through London. Then you can use QGIS to visualize them if desired. In pseudo code:
There's any number of potential traps here, e.g. how to keep attributes of your GPX file if you need them, or what happens if one GPX contains multiple tracks, or whether you want to process routes or tracks, etc., but with some patience and the right command line flags, things should turn out nicely. The advantage of this more complex process is that it will actually look at the track, not only the bounding box. (Even though it will only allow a rectangular "London".) Lastly, if you want to go super analytic on this, you could also import your shape file into a PostGIS database which would then allow you to check against a polygonal London boundary, or run queries like "which trails are in London for more than 50% of their length", "which trails are in London for more than 2km", or "which trails start in London and end more than 20km away" and whatnot. And no, this question is not OpenStreetMap related and should have been asked elsewhere. answered 13 Nov '15, 23:16 Frederik Ramm ♦ |
This shows a picture of GPS prune with hundreds of footpath kml files of several counties, it will also display mutiple GPXes. Multiple traces can be added with ctrl select. If you zoom in and click on a trace it will tell you the trace's id and other info all displayed on over OSM. The kml are from http://www.rowmaps.com/ and prune is from here http://activityworkshop.net/software/gpsprune/ Prune may help you. and if you have an interest England's Rights of Way the other link is very useful. answered 08 Nov '15, 21:53 andy mackey |
could be useful to pick one track out of those many, and then upload this track to OSM. Then your question is related to OSM. :-)
could you please clarify what you mean by "automate"? Do you want to do this once? Do you want this to be strictly fully automatic?
As automated as reasonably possible-- ie is there some kind of software I could use to do this for me. I may want to do this again in future, but just a one off at this point.
If you open a trace with a text editor you will see lats, lons, times and dates they may help you sort them. Was i in London then? or is it >51.3 and <51.7 north and/or between -.7 and +.2 lon.