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

Output GPX routes #10

Closed
wants to merge 3 commits into from
Closed

Conversation

JarnoLeConte
Copy link
Contributor

Instead of tracks <trk> also routes <rte> could be returned if the option {"gpx.rte": true} is provided. Evenmore you can specify to disable the <trk> or <wpt> output by setting {"gpx.trk": false, "gpx.wpt": false}.

Where MultiString, Polygon, MultiPolygon, and GeometryCollection will return a single track consisting of possibly multiple track segments, in the case of routes just multiple routes are returned due the lack of segments in that format.

Example:

togpx({
  type: "Feature",
  properties: {},
  geometry: {
    type: "GeometryCollection",
    geometries: [
      { "type": "MultiPoint",
        "coordinates": [ [31.0, 0.0], [32.0, 0.0] ]
      },
      { "type": "MultiLineString",
        "coordinates": [ [[101.0, 0.0], [102.0, 1.0]], [[103.0, 0.0], [104.0, 1.0]] ]
      }
    ]
  }
}, {"gpx.rte": true})

Output:

<gpx creator="togpx" version="1.1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">

  <wpt lat="0" lon="31">
    <name/>
    <desc/>
  </wpt>

  <wpt lat="0" lon="32">
    <name/>
    <desc/>
  </wpt>

  <trk>
    <name/>
    <desc/>
    <trkseg>
      <trkpt lat="0" lon="101"/>
      <trkpt lat="1" lon="102"/>
    </trkseg>
    <trkseg>
      <trkpt lat="0" lon="103"/>
      <trkpt lat="1" lon="104"/>
    </trkseg>
  </trk>

  <rte>
    <name/>
    <desc/>
    <rtept lat="0" lon="101"/>
    <rtept lat="1" lon="102"/>
  </rte>

  <rte>
    <name/>
    <desc/>
    <rtept lat="0" lon="103"/>
    <rtept lat="1" lon="104"/>
  </rte>

</gpx>

@JarnoLeConte
Copy link
Contributor Author

If you are planning to accept this PR, you can better look at #11. That PR is built on top of this one. In meantime lots has changed, so it's not worth spent a lot time to make this PR perfect, I guess.

Sorry, I haven't done PR's before. It's almost new to me.

@tyrasd
Copy link
Owner

tyrasd commented May 25, 2016

I see. Let's close this one.

@tyrasd tyrasd closed this May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants