GPX slippy map
This renders GPX files on-the-fly to a transparent slippy-map layer, allowing you to browse tracklogs in more detail than the existing preview image.
Front page is at:
http://dev.openstreetmap.org/~ojw/gpx/list.php
Note thas to find the .gpx ID, you have to go to your own gpx page and try to download it. Something like 1234567.gpx will be proposed, the first 7 numbers are the ID.
Or browse to a URL of the form:
http://dev.openstreetmap.org/~ojw/gpx/?gpx=[the GPX trace ID]
e.g.
http://dev.openstreetmap.org/~ojw/gpx/?gpx=113257
Overview
Source code
Download from:
http://svn.openstreetmap.org/applications/rendering/gpx_slippy_map/
revision history is viewable at:
http://trac.openstreetmap.org/browser/applications/rendering/gpx_slippy_map
Benchmarks
For a 9999-point tracklog:
- Render tile containing data: 140 ms
- Download and process new tracklog: 800ms
- Render tile without data: 3 ms
Optimisations done
- check if bounding box is completely outside the tile, and if so don't draw anything
- precalculate mercator projections when storing tracklog, rather than when drawing tile
- save some space by storing points as integer not floating point
Optimisations to do
- Support for gziped gpx files i.e. 2009_03_29_1600.gpx.gz
please add any suggestions here
How you can help
- If someone could setup a cache in front of the tileserver that would be great (i.e. subsequent HTTP requests for the same tile should come from your disk not from dev server)
- GPX tiles never expire if that helps your caching policy (because a given GPX-id/x/y/z will always return the same image unless the rendering software changes)
Binary file format
# +---------+--------+------+--------------------------+ # | size | type | name | description | # +---------+--------+------+--------------------------+ # | 4 bytes | int | n | number of trackpoints | # | 8 bytes | double | xmin | bounding box (W) | # | 8 bytes | double | xmax | bounding box (E) | # | 8 bytes | double | ymin | bounding box (S) | # | 8 bytes | double | ymax | bounding box (N) | # +---------+--------+------+--------------------------+ # then n pairs of: # +---------+--------+------+--------------------------+ # | 4 bytes | int | x | coded position | # | 4 bytes | int | y | coded position | # +---------+--------+------+--------------------------+ # # xmin,xmax,ymin,ymax,x,and y are stored as positions # relative to the coverage of the slippy map system # # x positions from 0 = 180 degrees west to 1 = 180 degrees west # y positions from 0 = 85.0511 north to 1 = 85.0511 south # # note that these are in the mercator projection, i.e. # dLat/dy is not constant # # encoding of x and y: # the positions described above are divided by 2^31 for # storage as an integer, # i.e.: # x: 0 = fully west, to 2^31-1 = fully east # y: 0 = fully north, to 2^31-1 = fully south # # integers are big-endian # double-precision floats are platform-dependant