Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only the first segment of GPX tracks is imported #375

Closed
asaunier opened this issue Sep 15, 2017 · 10 comments
Closed

Only the first segment of GPX tracks is imported #375

asaunier opened this issue Sep 15, 2017 · 10 comments
Labels
enhancement New feature or request imported from v6 Issue created on v6 repo stale Issue with no activity, will be close soon

Comments

@asaunier
Copy link
Member

When uploading a GPX track with several segments (for instance if the GPS has been turned off while recording), all segments are shown on the document editing form map but only the first segment is actually sent to the API.

Most likely because of https://github.com/c2corg/v6_ui/blob/master/c2corg_ui/static/js/editing/documentediting.js#L428

It would make sense to concatenate segments instead so the the whole track is sent to the API and saved to the document.

Simplified example of multi-segment GPX file:

<?xml version="1.0" encoding="UTF-8"?>
<gpx xmlns="http://www.topografix.com/GPX/1/1" version="1.1" creator="MyGPSFiles" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <trk>
    <name>Bellegarde - St Cergue</name>
    <desc>Total: 63.6km</desc>
    <trkseg>
      <trkpt lat="46.11004142090678" lon="5.827384488657117">
        <ele>382.79998779296875</ele>
        <time>2017-09-10T03:11:34Z</time>
      </trkpt>
      <trkpt lat="46.110052736476064" lon="5.82740711979568">
        <ele>382.79998779296875</ele>
        <time>2017-09-10T03:11:36Z</time>
      </trkpt>
    </trkseg>
  </trk>
  <trk>
    <name>Bellegarde - St Cergue section 2</name>
    <trkseg>
      <trkpt lat="46.36913954280317" lon="6.017430983483791">
        <ele>1330.199951171875</ele>
        <time>2017-09-10T12:09:55Z</time>
      </trkpt>
      <trkpt lat="46.369090508669615" lon="6.017514215782285">
        <ele>1330</ele>
        <time>2017-09-10T12:10:02Z</time>
      </trkpt>
    </trkseg>
  </trk>
</gpx>
@asaunier asaunier changed the title Only the first segment of GPX tracks are imported Only the first segment of GPX tracks is imported Sep 19, 2017
@pixelfr
Copy link
Contributor

pixelfr commented Dec 5, 2017

This issue seems similar to that one:
https://gis.stackexchange.com/questions/240697/how-to-merge-two-or-more-features-in-openlayers

I can start to implement the solution with JSTS.

@pixelfr
Copy link
Contributor

pixelfr commented Dec 6, 2017

I made the following commit Pixelfr@cc8c1cb2b3fa97cb6c68658d2dc3306b57522235

But closure-util complains about a missing require although I thought declaring an extern for JSTS would be enough:

ui_1  | info closure-util Reading build config
ui_1  | info closure-util Getting Closure dependencies
ui_1  | info closure-util Compiling 533 sources
ui_1  | ERR! compile /var/www/c2corg_ui/static/js/gpxupload.js:70: ERROR - missing require: 'jsts.io.OL3Parser'
ui_1  | ERR! compile     var parser = new jsts.io.OL3Parser();
ui_1  | ERR! compile                  ^
ui_1  | ERR! compile 

I am not very familiar with closure and I probably missed something... Any hint?

@asaunier
Copy link
Member Author

asaunier commented Dec 6, 2017

Thanks @pixelfr for having a look at this issue!

I am not sure what the problem is exactly. Closure seems to expect some missing definition?
Perhaps your externs file for JSTS is not correct? You may try to compare it with for instance https://github.com/c2corg/v6_ui/blob/master/c2corg_ui/externs/ui-bootstrap.js

@pixelfr
Copy link
Contributor

pixelfr commented Dec 6, 2017

Clearly my externs file was not correct. I added JSdoc declarations here but I still get the same error when I use docker-compose up. However, when I directly make, the new externs file is seen and everything compiles correctly.

This is weird, I get a different behavior from closure-util when I make -f config/dev build and when I use docker-compose up, even after I created a new docker machine. What am I supposed to reinitialize to get docker-compose to work?

edit: files at the root are not updated on the docker machine with docker-compose up. I manually copied the files to machine and the problem is solved!

@pixelfr
Copy link
Contributor

pixelfr commented Dec 7, 2017

I just pushed a new commit which solves some issues pixelfr@a43d0d03cd41334180e5c89bb5cbdbba8d1fde14
But the binding to JSTS is still not functional.
I get this error:
screenshot 2017-12-07 01 35 04
on this line
I am not sure JSTS is correctly bound (or if it is possible to bind it at all...).

@asaunier
Copy link
Member Author

asaunier commented Dec 7, 2017

@pixelfr I recommend that you create a pull request with your gps_merge_tracks branch. This way we could see your changes (diff) and discuss them directly in the PR. See for instance https://github.com/c2corg/v6_ui/wiki/Howto-Contribute#and-open-a-pull-request

@pixelfr
Copy link
Contributor

pixelfr commented Dec 7, 2017

Sure. I didn't do it because it was still not working. But yes I going to to the PR.

@asaunier
Copy link
Member Author

asaunier commented Dec 7, 2017

No problem to create a PR even if the changes are not ready. We generally prefix the titles of those PR by "[WIP]" (Work in Progress).

@cbeauchesne cbeauchesne transferred this issue from c2corg/v6_ui Apr 1, 2019
@cbeauchesne cbeauchesne added enhancement New feature or request imported from v6 Issue created on v6 repo labels Apr 1, 2019
@stale
Copy link

stale bot commented Jun 30, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issue with no activity, will be close soon label Jun 30, 2019
@stale
Copy link

stale bot commented Jul 14, 2019

This issue has been closed because it has not had recent activity. Do not hesitate to reopen it if necessary.

@stale stale bot closed this as completed Jul 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request imported from v6 Issue created on v6 repo stale Issue with no activity, will be close soon
Projects
None yet
Development

No branches or pull requests

3 participants