Potlatch 1/Development overview/GPS tracks

From OpenStreetMap Wiki
Jump to: navigation, search

Potlatch deals with GPS tracks in two different ways. There's the GPS tracks for the current area, loaded by clicking the GPS button in the client; and there's the ability to preload a track, which you do by clicking the 'edit' link next to a GPS track on the main site.

Tracks for the current area

Source code: http://trac.openstreetmap.org/browser/sites/rails_port/app/controllers/swf_controller.rb

These GPS tracks are generated dynamically, server-side.

swf_controller.rb sends a query to the database. It then hand-assembles an SWF containing the resulting lines. This is loaded into Potlatch as a nested movie clip.

Whenever a new track starts, or there's a gap of more than a few minutes between points, Potlatch breaks the line.

The SWF-generating code is a little hairy but you should never need to change it.

Preloaded tracks

Source code: http://trac.openstreetmap.org/browser/applications/editors/potlatch/gps.as

You can also load a whole GPX file into Potlatch at once. In this case, Potlatch parses the XML client-side and draws the line accordingly (though in the same visual style as above). Because of this, you cannot use this on gzipped or other compressed tracks.

There is also code to simplify the tracklog (using the Douglas-Peucker algorithm) and convert it into locked ways.