[Openstreetmap-dev] Feature extraction from GPS tracks (was: Standalone OpenStreetMap editor)

Schuyler Erle schuyler at nocat.net
Fri Apr 22 18:37:10 BST 2005

* On 18-Apr-2005 at  1:11AM PDT, Nick Whitelegg said:
> Does anyone have any thoughts/comments on this, given future features of the 
> standalone app would include overlaying Landsat and possibly other aerial 
> photo data? Know Java has some performance issues on large and complex apps, 
> but in this case, the network would appear to be the rate-determining factor.

I plan to build a standalone client using Python and GTk+. I already
have a goodly part of the code written, but that should by no means
stop you if you want to write one in Java. I think there ought to be a
multiplicity of tools available.

On that note, I have spent months now arsing about with methods for
taking track points and abstracting them into lines that might be
tagged as roads or walkways. All of my code is here:


In particular, have a look at simplextract.py, which represents my
first attempt to apply Douglas-Peucker line simplification to a set of
track points. I got hung up on trying to detect and merge parallel
line segments. Right now I think this has the most promise.

I abstracted my D-P code a bit into an OGR filter that takes, say, a
shapefile on one end, and spits out a version generalized to some
tolerance. This can be found in simplify.py, but it still needs a bit
of debugging with the latest version of OGR.

Finally, have a look at hough.py, which represents my attempts to
apply a windowed Hough transform to a GPS track point set. It seems
tantalizingly close but my maths are obviously off somewhere. (Matt
Amos, please take note!)

Additionally, you will find a Python class designed for parsing GPX data
in gpx.py, and sample data in GPX and in shapefile (projected into UTM
zone 30) in that same directory.

In general, I have tried hard to make use of the existing Open Source
GIS libraries (particularly OGR and its Python bindings), as I feel
this is very important for us to maintain interoperability with each
other and especially other projects. Obviously, if we use the same
interchange formats (e.g. GPX, Shapefile, etc.) this isn't so
important, but I find that OGR offers a great deal of leverage in
terms of dealing with data in any format.

I would really appreciate feedback from anyone with an interest in the
subject of automating feature extraction from GPS data! I feel like my
code is at the 80% point and I just need some feedback from folks with
better experience in computational geometry than I have. I think these
techniques could prove quite useful.


More information about the dev mailing list