flopp / GpxTrackPoster

Create a visually appealing poster from your GPX tracks
MIT License
411 stars 50 forks source link

Add BBox Option to Heatmap Poster #7

Open flopp opened 7 years ago

flopp commented 7 years ago

Add bbox option (--bbox COORDS1;COORDS2) to restrict the extent of the heatmap poster.

Rationale: if there are some tracks in your collection that are far away from the other tracks (e.g. runs during vacation), the heatmap poster becomes useless.

lefty01 commented 7 years ago

hi, i was looking for the same feature as well ;) actually I started looking at the heatmap_drawer.py and thought that it might be as easy as overwrite min/max values in this line:

(min_x, min_y, max_x, max_y) = utils.compute_bounds_xy(xy_polylines) but so far I got no good result. If you could give some hints here, maybe I could try them in my fork. For the argument passing probably just add lat/long coordinates to the TracksDrawer draw method (although there are quite some args there already;))

laufhannes commented 7 years ago

Shall all the statistics on the poster's bottom be calculated based on all tracks or only on filtered tracks?

@lefty01 I guess track_loader.py::__filter_tracks(self, tracks) is the right place and you might need something similar to utils.py::compute_bounds_xy(polylines) for lat/lng.

lefty01 commented 7 years ago

hi I pushed my works I had so far to my fork and submitted a pull request ... you can review the changes and I would be glad to hear any feedback if that makes sense... at least it works (as in works for me ;)) I do the restriction by overriding the min/max x/y values as inidcated in my previous comment. This has the drawback to to update the statistics.

so maybe I give your idea with filtering all tracks beforehand and see if they match the given boundaries. @laufhannes I haven't checked your code for the map feature but does this include this filter already?

cheers andreas

laufhannes commented 7 years ago

@lefty01 Nope, my work on the background map does use all tracks.

lefty01 commented 7 years ago

hi, now had some more time to look into this ... as discussed in the old pull-request comment: https://github.com/flopp/GpxTrackPoster/pull/11#issuecomment-277192687 I made use of gpxpy's get_bounds function to add track bounds as an attribute to each track while loading gpx (will be stored to cache too). first stage filter should be in place and check if track is completly out of the requested bbox bounds. you can find those at this branch: comments/suggestions etc. welcome https://github.com/lefty01/GpxTrackPoster/tree/heatmap-border

flopp commented 6 years ago

a3d57b8ab46ef88366de22153200eb355e0c3d90:

add options --heatmap-center LAT,LNG and --heatmap-radius RADIUS_KM to specify the heatmap's center coordinates, and a radius around this center (in km). The scale factor of the heatmap will be computed in a way that all tracks in this circle will be visible.