[OSM-dev] [Talk-GB] GPS Tracks downloaded from OSM in JOSM
Richard Fairhurst
richard at systemeD.net
Wed Apr 18 12:42:33 BST 2007
Tim Müller wrote:
> I've run into this too and filed the following feature request for JOSM:
>
> http://josm.eigenheimstrasse.de/ticket/132
>
> If there's a better workaround than disabling line drawing between GPS
> points altogether, I'd love to hear about it too.
At present the API uses SQL a bit like this[1] to get GPS points:
SELECT DISTINCTROW latitude, longitude FROM gps_points
WHERE latitude > ? AND latitude < ?
AND longitude > ? AND longitude < ?
ORDER BY timestamp DESC
(line 663 at
http://trac.openstreetmap.org/browser/sites/www.openstreetmap.org/ruby/api/osm/dao.rb)
For something more suitable for drawing lines, this could be used:
SELECT gps_points.latitude,gps_points.longitude,
gpx_files.id AS fileid,UNIX_TIMESTAMP(gps_points.timestamp) AS ts
FROM gpx_files,gps_points
WHERE gpx_files.id=gpx_id
AND (gps_points.longitude BETWEEN ? AND ?)
AND (gps_points.latitude BETWEEN ? AND ?)
ORDER BY fileid,ts
i.e. you're ordering by GPX file id, then timestamp.
Then, as you iterate over each point, only draw a line if fileid is
the same, and the interval between timestamp and the previous
timestamp is less than 180 (say). For privacy reasons it may be better
to do this on the API side rather than returning raw timestamps to the
user.
Maybe one for 0.5?
cheers
Richard
[1] I've removed the multiplier, LIMIT 5000 etc. to make it more readable.
More information about the dev
mailing list