I have a bunch of GPX files and I want to find out which files contain tracks located in certain geographic extent, e.g. files containing tracks in Pennsylvania. Also, the inverse is also useful too, e.g. any file containing tracks not in USA. How to do this using any command line tool?

Gpsbabel's polygon filter looks like what I want. But for some reason I could not make it work. The filter does not filter anything. I am not sure whether the polygon filter works with track data. This is how I run it:

ogrinfo is just what I need. I eventually used ogrinfo -so infile.gpx -spat xmin ymin xmax ymax | grep 'Extent'. If there are tracks in the given bounding box, the Extent value will be available.
–
ejelMar 4 '11 at 3:23