Hi Rodolfo, > I was trying to figure out how to implement this feature. > > The idea I got comprised to step: > > 1 extracting the list of locations from the data base. I thought the > location is the first point of the record. In order to extract the > information the gpx files has to be parsed which takes a while (minutes). > Then you can reduce the locations using the Gpx method > _distance_between_points.
When displaying activities in maps, there is one important concept: map centering. The idea is to virtually build a box with max and min latitude and longitude, so the center of that box can be used to center the map that contains the activity. Please notice that currently pytrainer stores start and end points for each lap in laps table. > 2 presenting the data on google maps or OSM. Once you have a list of > location points it easy to create a map. > > To reduce the time of parsing gpx files I considered two options: > > 1 Create a new table in the database. This table would contain the > record_id, latitude and longitude so the first time the locations are > extracted from the gpx files but they would be available from then on. This > way no database porting is required. As said above, that currently exists: sqlite> select record,lap_number,start_lat,start_lon,end_lat,end_lon from laps where record = 1076; 1076|0|43.54063505|-5.65097937|43.54390651|-5.64593129 1076|1|43.54390601|-5.64591821|43.5484153|-5.63819245 1076|2|43.54842134|-5.63818289|43.55021775|-5.63248806 1076|3|43.550219|-5.63248655|43.55022043|-5.6325759 1076|4|43.55021087|-5.63258411|43.54838043|-5.63826151 1076|5|43.54836895|-5.63826763|43.54378581|-5.64604662 1076|6|43.54377106|-5.64606163|43.54060739|-5.65049976 sqlite> But I think this way is not the best one, but the "center point" approach explained before. Regarding database approach, it might be simpler to add a new table as you describe. > 2 Change the gpx object so the parsing is stopped after getting the first > point while maintaining the current functionality. Bufff... gpx parsing is quite a mess (I still have ticket #165 on my ToDo btw) so unless a bug fix or minor change, I would rather not touch until refactoring. > I was also considering how to unit tests the new databases queries and the > solution I found is to create a directory within pytrainer/test which > contains a database with a known state so the tests could run on that. > > I don´t really know how to integrate all this with the GUI. My idea right > now is to add a button on the week, month, year and totals tabs. This button > would open a new window showing the locations on the map pretty much like > the existing map tab. Good question. I don't think a new window is a good idea but expanding current one. > Finally is the issue of accessing the list of activities from a location is > something I can´t figure out how to implement. Can you click on the map and > get an event? I'm sorry I don't get the point here. Do you mean clicking one point on a map and get what is X km/miles around? I guess that if you can see the map, then activities around are visible as well, aren't they? I think better approach would be to introduce a location (or its GPS coordinates. In case location is provided, you will need to find GPS coordinates out using some webservice), a suitable distance to look around (1 km/miles, 5km/miles, etc.) and then implement an algorithm that searches for activities (i.e. center points) which fit in requested range. Regards, David ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ Pytrainer-devel mailing list Pytrainer-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytrainer-devel