now preserves time information loaded in waypoints/tracks/routes

merge-requests/1/head
Julien Veyssier 2016-12-12 14:36:49 +01:00
parent 7fe8a76898
commit 3e655feccd
4 changed files with 55 additions and 19 deletions

View File

@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] ## [Unreleased]
### Changed
- keep time information in loaded tracks/routes/waypoints, written in saved files
## 0.0.2 2016-12-08 ## 0.0.2 2016-12-08
### Added ### Added

View File

@ -1,8 +1,6 @@
# GpxEdit owncloud/nextcloud application # GpxEdit owncloud/nextcloud application
If you want to help to translate this app in your language, take the english=>french files in "l10n" directory as examples. Simple Owncloud/Nextcloud app to load, edit and save GPX files on an interactive map.
Simple Owncloud/Nextcloud app to load, edit and save GPX file on an interactive map.
You can load/save files from your Owncloud/Nextcloud file storage. You can load/save files from your Owncloud/Nextcloud file storage.
GPX, KML, CSV (unicsv format) and geotagged JPG are supported for loading. JPG files will be loaded as waypoints. GPX, KML, CSV (unicsv format) and geotagged JPG are supported for loading. JPG files will be loaded as waypoints.
There is a file explorer inside the app interface to select a file to load and a folder to save what is currently on the map. There is a file explorer inside the app interface to select a file to load and a folder to save what is currently on the map.
@ -17,6 +15,7 @@ What's saved :
- points - points
- coordinates - coordinates
- elevation (just preserves loaded values) - elevation (just preserves loaded values)
- time (just preserves loaded values)
- waypoint - waypoint
- coordinates - coordinates
- name - name
@ -24,9 +23,10 @@ What's saved :
- description - description
- symbol - symbol
- elevation (just preserves loaded value) - elevation (just preserves loaded value)
- time (just preserves loaded value)
**WARNING** GpxEdit does not load/save any time data, even if you loaded a gpx file which has time information. Keep that in mind if you overwrite a file. GpxEdit does load/save time data.
Elevation data is loaded and saved but every new data added by user actions in GpxEdit will have neither elevation nor time data. Elevation data is loaded and saved but every new waypoint/track/trackpoint added by user actions in GpxEdit will have neither elevation nor time data.
Tracks are saved with one segment. Tracks are saved with one segment.
@ -41,7 +41,7 @@ GpxEdit :
- works with shared files. - works with shared files.
- loads GPX, KML, unicsv CSV, geotagged JPG files - loads GPX, KML, unicsv CSV, geotagged JPG files
- loads tracks, routes and waypoints - loads tracks, routes and waypoints
- saves tracks and waypoints - saves tracks, routes and waypoints
- supports waypoint symbols - supports waypoint symbols
- uses [Leaflet.Draw](https://github.com/Leaflet/Leaflet.draw) amazing plugin - uses [Leaflet.Draw](https://github.com/Leaflet/Leaflet.draw) amazing plugin
- uses many other Leaflet plugins like Minimap, Sidebar2, MeasureControl, MousePositionControl - uses many other Leaflet plugins like Minimap, Sidebar2, MeasureControl, MousePositionControl
@ -49,3 +49,5 @@ GpxEdit :
- uses [JQuery File Tree](https://github.com/jqueryfiletree/jqueryfiletree) amazing file tree library - uses [JQuery File Tree](https://github.com/jqueryfiletree/jqueryfiletree) amazing file tree library
Any feedback will be appreciated. Any feedback will be appreciated.
If you want to help to translate this app in your language, take the english=>french files in "l10n" directory as examples.

View File

@ -5,9 +5,7 @@
<description> <description>
# GpxEdit owncloud/nextcloud application # GpxEdit owncloud/nextcloud application
If you want to help to translate this app in your language, take the english=>french files in "l10n" directory as examples. Simple Owncloud/Nextcloud app to load, edit and save GPX files on an interactive map.
Simple Owncloud/Nextcloud app to load, edit and save GPX file on an interactive map.
You can load/save files from your Owncloud/Nextcloud file storage. You can load/save files from your Owncloud/Nextcloud file storage.
GPX, KML, CSV (unicsv format) and geotagged JPG are supported for loading. JPG files will be loaded as waypoints. GPX, KML, CSV (unicsv format) and geotagged JPG are supported for loading. JPG files will be loaded as waypoints.
There is a file explorer inside the app interface to select a file to load and a folder to save what is currently on the map. There is a file explorer inside the app interface to select a file to load and a folder to save what is currently on the map.
@ -30,8 +28,8 @@ What's saved :
- symbol - symbol
- elevation (just preserves loaded value) - elevation (just preserves loaded value)
**WARNING** GpxEdit does not load/save any time data, even if you loaded a gpx file which has time information. Keep that in mind if you overwrite a file. GpxEdit does load/save time data.
Elevation data is loaded and saved but every new data added by user actions in GpxEdit will have neither elevation nor time data. Elevation data is loaded and saved but every new waypoint/track/trackpoint added by user actions in GpxEdit will have neither elevation nor time data.
Tracks are saved with one segment. Tracks are saved with one segment.
@ -46,7 +44,7 @@ GpxEdit :
- works with shared files. - works with shared files.
- loads GPX, KML, unicsv CSV, geotagged JPG files - loads GPX, KML, unicsv CSV, geotagged JPG files
- loads tracks, routes and waypoints - loads tracks, routes and waypoints
- saves tracks and waypoints - saves tracks, routes and waypoints
- supports waypoint symbols - supports waypoint symbols
- uses [Leaflet.Draw](https://github.com/Leaflet/Leaflet.draw) amazing plugin - uses [Leaflet.Draw](https://github.com/Leaflet/Leaflet.draw) amazing plugin
- uses many other Leaflet plugins like Minimap, Sidebar2, MeasureControl, MousePositionControl - uses many other Leaflet plugins like Minimap, Sidebar2, MeasureControl, MousePositionControl
@ -55,6 +53,8 @@ GpxEdit :
Any feedback will be appreciated. Any feedback will be appreciated.
If you want to help to translate this app in your language, take the english=>french files in "l10n" directory as examples.
</description> </description>
<licence>AGPL</licence> <licence>AGPL</licence>
<summary>Simple GPX file editor</summary> <summary>Simple GPX file editor</summary>

View File

@ -460,7 +460,14 @@ function onCreated(type, layer){
layer.gpxedit_id = gpxedit.id; layer.gpxedit_id = gpxedit.id;
layer.type = layerType; layer.type = layerType;
gpxedit.layersData[gpxedit.id] = {name:'', description:'', comment:'', symbol:'', layer: layer}; gpxedit.layersData[gpxedit.id] = {
name:'',
description:'',
comment:'',
symbol:'',
time: '',
layer: layer
};
gpxedit.editableLayers.addLayer(layer); gpxedit.editableLayers.addLayer(layer);
gpxedit.id++; gpxedit.id++;
return layer; return layer;
@ -512,6 +519,7 @@ function generateGpx(){
var name = gpxedit.layersData[id].name; var name = gpxedit.layersData[id].name;
var comment = gpxedit.layersData[id].comment; var comment = gpxedit.layersData[id].comment;
var description = gpxedit.layersData[id].description; var description = gpxedit.layersData[id].description;
var time = gpxedit.layersData[id].time;
if (layer.type === 'marker'){ if (layer.type === 'marker'){
var symbol = gpxedit.layersData[id].symbol; var symbol = gpxedit.layersData[id].symbol;
var lat = layer._latlng.lat; var lat = layer._latlng.lat;
@ -536,6 +544,9 @@ function generateGpx(){
if (description){ if (description){
gpxText = gpxText + ' <desc>'+description+'</desc>\n'; gpxText = gpxText + ' <desc>'+description+'</desc>\n';
} }
if (time){
gpxText = gpxText + ' <time>'+time+'</time>\n';
}
gpxText = gpxText + ' </wpt>\n'; gpxText = gpxText + ' </wpt>\n';
} }
else if(layer.type === 'track'){ else if(layer.type === 'track'){
@ -557,7 +568,11 @@ function generateGpx(){
var lat = layer._latlngs[i].lat; var lat = layer._latlngs[i].lat;
var lng = layer._latlngs[i].lng; var lng = layer._latlngs[i].lng;
var alt = layer._latlngs[i].alt; var alt = layer._latlngs[i].alt;
var time = layer._latlngs[i].time;
gpxText = gpxText + ' <trkpt lat="'+lat+'" lon="'+lng+'">\n'; gpxText = gpxText + ' <trkpt lat="'+lat+'" lon="'+lng+'">\n';
if (time !== undefined){
gpxText = gpxText + ' <time>'+time+'</time>\n';
}
if (alt !== undefined){ if (alt !== undefined){
gpxText = gpxText + ' <ele>'+alt+'</ele>\n'; gpxText = gpxText + ' <ele>'+alt+'</ele>\n';
} }
@ -583,7 +598,11 @@ function generateGpx(){
var lat = layer._latlngs[i].lat; var lat = layer._latlngs[i].lat;
var lng = layer._latlngs[i].lng; var lng = layer._latlngs[i].lng;
var alt = layer._latlngs[i].alt; var alt = layer._latlngs[i].alt;
var time = layer._latlngs[i].time;
gpxText = gpxText + ' <rtept lat="'+lat+'" lon="'+lng+'">\n'; gpxText = gpxText + ' <rtept lat="'+lat+'" lon="'+lng+'">\n';
if (time !== undefined){
gpxText = gpxText + ' <time>'+time+'</time>\n';
}
if (alt !== undefined){ if (alt !== undefined){
gpxText = gpxText + ' <ele>'+alt+'</ele>\n'; gpxText = gpxText + ' <ele>'+alt+'</ele>\n';
} }
@ -597,7 +616,7 @@ function generateGpx(){
} }
// adds a marker and initialize its data // adds a marker and initialize its data
function drawMarker(latlng, name, desc, cmt, sym){ function drawMarker(latlng, name, desc, cmt, sym, time){
var wst = $('#markerstyleselect').val(); var wst = $('#markerstyleselect').val();
var tst = $('#tooltipstyleselect').val(); var tst = $('#tooltipstyleselect').val();
var symboo = $('#symboloverwrite').is(':checked'); var symboo = $('#symboloverwrite').is(':checked');
@ -621,16 +640,22 @@ function drawMarker(latlng, name, desc, cmt, sym){
gpxedit.layersData[layer.gpxedit_id].comment = cmt; gpxedit.layersData[layer.gpxedit_id].comment = cmt;
gpxedit.layersData[layer.gpxedit_id].description = desc; gpxedit.layersData[layer.gpxedit_id].description = desc;
gpxedit.layersData[layer.gpxedit_id].symbol = sym; gpxedit.layersData[layer.gpxedit_id].symbol = sym;
gpxedit.layersData[layer.gpxedit_id].time = time;
} }
// adds a polyline and initialize its data // adds a polyline and initialize its data
function drawLine(latlngs, name, desc, cmt, gpxtype){ function drawLine(latlngs, name, desc, cmt, gpxtype, times){
var wst = $('#markerstyleselect').val(); var wst = $('#markerstyleselect').val();
var tst = $('#tooltipstyleselect').val(); var tst = $('#tooltipstyleselect').val();
var p = L.polyline(latlngs, { var p = L.polyline(latlngs, {
color: '#f357a1', color: '#f357a1',
weight: 7 weight: 7
}); });
if (times.length === p._latlngs.length){
for (var i=0; i<times.length; i++){
p._latlngs[i].time = times[i];
}
}
var layer = onCreated(gpxtype, p); var layer = onCreated(gpxtype, p);
if (name !== ''){ if (name !== ''){
if (tst === 'p'){ if (tst === 'p'){
@ -657,11 +682,12 @@ function parseGpx(xml){
var desc = $(this).find('desc').text(); var desc = $(this).find('desc').text();
var sym = $(this).find('sym').text(); var sym = $(this).find('sym').text();
var ele = $(this).find('ele').text(); var ele = $(this).find('ele').text();
var time = $(this).find('time').text();
if (ele !== ''){ if (ele !== ''){
drawMarker([lat, lon, ele], name, desc, cmt, sym); drawMarker([lat, lon, ele], name, desc, cmt, sym, time);
} }
else{ else{
drawMarker([lat, lon], name, desc, cmt, sym); drawMarker([lat, lon], name, desc, cmt, sym, time);
} }
}); });
dom.find('trk').each(function(){ dom.find('trk').each(function(){
@ -669,11 +695,14 @@ function parseGpx(xml){
var name = $(this).find('>name').text(); var name = $(this).find('>name').text();
var cmt = $(this).find('>cmt').text(); var cmt = $(this).find('>cmt').text();
var desc = $(this).find('>desc').text(); var desc = $(this).find('>desc').text();
var times = [];
$(this).find('trkseg').each(function(){ $(this).find('trkseg').each(function(){
$(this).find('trkpt').each(function(){ $(this).find('trkpt').each(function(){
var lat = $(this).attr('lat'); var lat = $(this).attr('lat');
var lon = $(this).attr('lon'); var lon = $(this).attr('lon');
var ele = $(this).find('ele').text(); var ele = $(this).find('ele').text();
var time = $(this).find('time').text();
times.push(time);
if (ele !== ''){ if (ele !== ''){
latlngs.push([lat,lon,ele]); latlngs.push([lat,lon,ele]);
} }
@ -682,17 +711,20 @@ function parseGpx(xml){
} }
}); });
}); });
drawLine(latlngs, name, desc, cmt, 'track'); drawLine(latlngs, name, desc, cmt, 'track', times);
}); });
dom.find('rte').each(function(){ dom.find('rte').each(function(){
var latlngs = []; var latlngs = [];
var name = $(this).find('>name').text(); var name = $(this).find('>name').text();
var cmt = $(this).find('>cmt').text(); var cmt = $(this).find('>cmt').text();
var desc = $(this).find('>desc').text(); var desc = $(this).find('>desc').text();
var times = [];
$(this).find('rtept').each(function(){ $(this).find('rtept').each(function(){
var lat = $(this).attr('lat'); var lat = $(this).attr('lat');
var lon = $(this).attr('lon'); var lon = $(this).attr('lon');
var ele = $(this).find('ele').text(); var ele = $(this).find('ele').text();
var time = $(this).find('time').text();
times.push(time);
if (ele !== ''){ if (ele !== ''){
latlngs.push([lat,lon,ele]); latlngs.push([lat,lon,ele]);
} }
@ -700,7 +732,7 @@ function parseGpx(xml){
latlngs.push([lat,lon]); latlngs.push([lat,lon]);
} }
}); });
drawLine(latlngs, name, desc, cmt, 'route'); drawLine(latlngs, name, desc, cmt, 'route', times);
}); });
} }