[OSM-dev] [Talk-GB] GPS Tracks downloaded from OSM in JOSM

Robert (Jamie) Munro rjmunro at arjam.net
Wed Apr 18 13:17:14 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Richard Fairhurst wrote:
> 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

But fileid = gpx_files.id = gpx_id.

Surely all you need is:

SELECT DISTINCTROW latitude, longitude FROM gps_points
  WHERE latitude  > ? AND latitude  < ?
    AND longitude > ? AND longitude < ?
  ORDER BY gpx_id,timestamp DESC

I.e. just add gpx_id to the order_by.

I'm not sure it would work with the ATSL data because AFAICS, that is
one GPX file with the data from many tracking devices at the same time.

Robert (Jamie) Munro
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGJgxFz+aYVHdncI0RAjsLAJ4+wqKFAtC8IwrQOb0CJ7k+QDqzjQCg/BIS
x5fmLh42gVZ7vtZFCAyRXk0=
=lYg4
-----END PGP SIGNATURE-----




More information about the dev mailing list